Grigory Fateyev wrote:
> Hello!
> 
> I have simple class with ImageField, but cann't add any object:
> 
> class Book(models.Model):
>     name = models.CharField(_('Book Title'), maxlength=200)
>     book_number = models.IntegerField()
>     image = models.ImageField(upload_to='%Y/%m/%d/', core=True,
>                               blank=True) 
>     comment = models.TextField(_('Book Comment'), blank=True,
>                                null=True)
>     author = models.CharField(_('Author'), maxlength=100,
>                               blank=True) 
>     year_rate = models.IntegerField()
>     
>     class Meta:
>         verbose_name = _('Book')
>         verbose_name_plural = _('Books')
> 
>     class Admin:
>         list_display = ('book_number', 'name', 'year_rate')
> 
>     def __unicode__(self):
>         return u"%s %s %s" % (self.book_number, self.name,
> self.year_rate)
> 
> the error:
> 
> Traceback (most recent call last):
> File "/usr/lib/python2.4/site-packages/django/core/handlers/base.py" in
> get_response 77. response = callback(request, *callback_args,
> **callback_kwargs) File
> "/usr/lib/python2.4/site-packages/django/contrib/admin/views/decorators.py"
> in _checklogin 51. if 'post_data' in request.POST: File
> "/usr/lib/python2.4/site-packages/django/core/handlers/wsgi.py" in
> _get_post 135. self._load_post_and_files() File
> "/usr/lib/python2.4/site-packages/django/core/handlers/wsgi.py" in
> _load_post_and_files 113. self._post, self._files =
> http.parse_file_upload(self.environ['wsgi.input'], self.environ) File
> "/usr/lib/python2.4/site-packages/django/http/__init__.py" in
> parse_file_upload 71. raw_message = '\r\n'.join(['%s:%s' % pair for
> pair in header_dict.items()])
> 
>   AttributeError at /admin/books/book/add/
>   '_fileobject' object has no attribute 'items'
> 
> What the problem it can be?
> 

I just made a project with just that model.  works for me.
I would start by looking at these lines:

[EMAIL PROTECTED]:~/django/foo/foot$ grep static *
settings.py:# settings.py:MEDIA_ROOT = BASE_DIR+'/static/'
settings.py:MEDIA_URL = '/static/'
urls.py:    (r'^static/(?P<path>.*)$', 'django.views.static.serve', 
{'document_root': settings.BASE_DIR+'/static/', 'show_indexes': True}),

What version of django?  I am using current svn.

Carl K

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to