Grigory Fateyev wrote: > Hello Carl Karsten! > On Sun, 19 Aug 2007 21:39:31 -0500 you wrote: > >> 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 >> > > settings.py:MEDIA_ROOT = BASE_DIR+'/media/' > settings.py:MEDIA_URL = '/site_media/' > urls.py: (r'^site_media/(?P<path>.*)$', 'django.views.static.serve', > {'document_root': settings.BASE_DIR+'/media/', 'show_indexes':True}), > > Revision: 5946 > I used your settings, no problem. Python 2.5.1 (r251:54863, May 2 2007, 16:56:35) [EMAIL PROTECTED]:~/django/django_src$ svn up Updated to revision 5988. 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 -~----------~----~----~----~------~----~------~--~---