Not sure how well known this is but I thought I'd share seeing as how
it cost me a lot of time and I can't find any discussion of it:

I have a form for a model. The model has three fields, but I only want
one displayed in the form. So I do this:

class NoteForm(ModelForm):

    class Meta:
        model = Note
        fields = ('text')

Looks good, but craps out with: 'Caught an exception while rendering:
'NoneType' object has no attribute 'label''.

I checked the ModelForms documentation and they have this example when
discussing field exclusion:

class PartialAuthorForm(ModelForm):
    class Meta:
        model = Author
        exclude = ('birth_date',)

Notice the comma after 'birth_date'? That was it. Hope this helps
someone.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to