Monday 15 July 2013

Is there any way to make Django's USStateField() to not have a pre-selected value? -


I use USStateField () from the local flavourware of Deyggo in one of my models:

 MyClass (Models.Model): State = USStateField (empty = true)  

Then I created a form of that class:

  Class MyClassForm (forms.ModelForm): Square Meta: Model = MyClass  

When I display the form, the field "state" is a "drop down" box that is "pre-selected" has been done.

Is there a way to create a drop-down box to not see any pre-selected values ​​at all?

It seems a known issue (although I am not aware of the ticket - I ask again There is no ticket for, and if not, then):

(Forms.ModelForm): Square Meta: ... YOUR_STATE_CHOICES = List (STATE_CHOICES) YOUR_STATE_CHOICES.insert (0, ('', '---------')) state = USStatefield (widget = form. (Option = YOUR_STATE_CHOICES))

from the above code.


No comments:

Post a Comment