On Thu, Oct 1, 2009 at 5:33 AM, dijxtra <[email protected]> wrote:

>
> On Sep 30, 5:12 pm, Karen Tracey <[email protected]> wrote:
> > On Wed, Sep 30, 2009 at 10:53 AM, dijxtra <[email protected]> wrote:
> >
> > > I'm getting "'NoneType' object has no attribute 'widget'" exception
> > > and I just can't figure out where is the problem. Here is my error:
> >
> > > Django Version: 1.1
> >
> > > Traceback:
> > > [snip]
> >
> > In this form:
> >
> >    1. class DiaryEntryForm(ModelForm):
> >    2.     importance = models.IntegerField(choices=IMPORTANCE_CHOICES)
> >    3.     class Meta:
> >    4.         model = DiaryEntry
> >    5.         fields = ['text', 'date', 'type', 'importance']
> >
> > 'importance' has been specified as a model field instead of a form field.
> > It needs to be a form field, since this is a form, not a model.
>
> Damn. This one was obvious. But, despite of this bugfix, the error
> still remains.
>
> This one: http://pastebin.com/pastebin.php?diff=m1867a8ad
> Gives me this:
> Django Version: 1.1
>
> Traceback:
> [snip]
>
234.             value = field.widget.value_from_datadict(self.data,
> self.files, self.add_prefix(name))
>
> Exception Value: 'NoneType' object has no attribute 'widget'
>
>
OK, looking a bit further, the form lists 'type' in fields but I do not see
that field in the model?

(If you were only adding 'importance' to the form explicitly in order to try
to fix this error, best to get rid of it.  Best to go back to the simplest
version of your code that had problems when posting looking for solutions.
Posting the original version modified with fixes that don't fix the problem
just makes it more confusing.)

Karen

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to [email protected]
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