I want my ChoiceField in ModelForm to have a blank option (------) but it\'s required.
I need to have blank option to prevent user from accidentally skipping the field t
This works for at least 1.4 and later:
CHOICES = (
('', '-----------'),
('foo', 'Foo')
)
class FooForm(forms.Form):
foo = forms.ChoiceField(choices=CHOICES)
Since ChoiceField is required (by default), it will complain about being empty when first choice is selected and wouldn't if second.
It's better to do it like this than the way Yuji Tomita showed, because this way you use Django's localized validation messages.