Tuesday, 20 August 2013

giving initial value raises 'value for field is required' error in django

giving initial value raises 'value for field is required' error in django

Django form trips me many times...
I gave initial value to a ChoiceField
self.fields['thread_type'] = forms.ChoiceField(choices=choices,
widget=forms.Select,
initial=thread_type)
The form which is created with thread_type with the above code doesn't
pass is_valid() because 'thread_type' isn't provided.
(The error message is not in english so I can't give the exact error in
english)
What should I do to pass the is_valid() call?

No comments:

Post a Comment