forms problem in django 1.1
I have the following form:
class ModuleItemForm2(forms.ModelForm):
class Meta:
model = Module_item
fields = ('title', 'media', 'thumb', 'desc', 'default', 'player_option')
The model is:
class Module_item(models.Model):
title = models.CharField(max_length=100)
layout = models.CharField(max_length=5, choices=LAYOUTS_CHOICE)
media = models.CharField(help_text='Media url', max_length=500, blank=True, null=True)
conserv = models.ForeignKey(Conserv, help_text= 'Redirect to Conserv', blank=True, null=True)
conserve_section = models.CharField(max_length=100, help_text= 'Section within the redirected Conserv', blank=True, null=True)
parent = models.ForeignKey('self', help_text='Upper menu.', blank=True, null=True)
module = models.ForeignKey(Module, blank=True, null=True)
thumb = models.FileField(upload_to='sms/module_items/thumbs', blank=True, null=True)
desc = models.CharField(max_length=500, blank=True, null=True)
auto_play = models.IntegerField(help_text='Auto start play (miliseconds)', blank=True, null=True)
order = models.IntegerField(help_text='Display order', blank=True, null=True)
depth = models.IntegerField(help_text='The layout depth', blank=True, null=True)
flow_replace = models.IntegerField(blank=True, null=True)
default = models.IntegerField(help_text='The selected sub item (Note: Starting from 0)', blank=True, null=True)
player_options = models.CharField(max_length=1000, null=True, b开发者_开发问答lank=True)
In my view I build form:
module_item_form2 = ModuleItemForm2()
print module_item_form2
And I get the following error on the print line:
'NoneType' object has no attribute 'label'
It works fine with django 1.0.2. I see the error only in django 1.1.
Do you have an idea what am I doing wrong?
Regards, Arshavski Alexander.
You have player_options
in the model, but player_option
in the list of form fields. Does it work if you add the s
in the form fields tuple?
精彩评论