I have just updated to trunk and now I get a problem uploading files into a filefield so I did an interactive session in shellplus and got the following:
In [1]: from testsite.media.forms import MediaObjectForm In [2]: d = {u'path': "my test image.png"} In [3]: f = MediaObjectForm(d) In [4]: f.is_valid() --------------------------------------------------------------------------- AttributeError Traceback (most recent call last) /Volumes/PersonalItems/ContentCentre/development/BrokerService/code/ brokersite/<ipython console> in <module>() /Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site- packages/django/forms/forms.py in is_valid(self) 118 being ignored, returns False. 119 """ --> 120 return self.is_bound and not bool(self.errors) 121 122 def add_prefix(self, field_name): /Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site- packages/django/forms/forms.py in _get_errors(self) 109 "Returns an ErrorDict for the data provided for the form" 110 if self._errors is None: --> 111 self.full_clean() 112 return self._errors 113 errors = property(_get_errors) /Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site- packages/django/forms/forms.py in full_clean(self) 232 # Each widget type knows how to retrieve its own data, because some 233 # widgets split data over several HTML fields. --> 234 value = field.widget.value_from_datadict (self.data, self.files, self.add_prefix(name)) 235 try: 236 if isinstance(field, FileField): AttributeError: 'NoneType' object has no attribute 'widget' In [5]: f.is_valid() Out[5]: True As you can see the first time that I use is_valid() I get an AttributeError. The second time it works. MediaObjectForm looks like: class MediaObjectForm(forms.ModelForm): class Meta: model = MediaObject fields = ('path') Where MediaObject looks like this: class MediaObject(models.Model): name = models.CharField(max_length=256) path = models.FileField(_("File"), max_length=256, upload_to='tempUpload/') mob_mediaitem = models.ForeignKey(MediaItem) creation_date = models.DateTimeField(_("Creation date"), auto_now_add=True) Not sure why this has started happening right now. --~--~---------~--~----~------------~-------~--~----~ 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 django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---