this has got to be FAQ, but I can't find it for the life of me. I have an ordinary Django model class, which has been automatically been given a field called "id". Great. Now I want to use this field as a hidden value in a ModelForm, but whenever I add "id" to the list of fields in the form, I get an exception of "AttributeError: 'NoneType' object has no attribute 'label'"
So, for example: class Foobar(models.Model): foo = models.FloatField(max_length=10) bar = models.CharField(max_length=10) class FoobarForm(ModelForm): foo = forms.FloatField(label = '$') id = forms.HiddenField() class Meta: model = Foobar fields = ['foo','id'] And what I want to generate is something like this <input type="hidden" name="id" value="12345"> <input type="text" name="foo"> What am I missing? -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@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.