I am using Django 1.0.2. I wrote ModelForm supported by the model. This model has a ForeignKey, where blank = False. When Django generates HTML for this form, it creates a select box with one parameter for each row in the table referenced by ForeignKey. It also creates an option at the top of the list that does not matter and is displayed as a series of dashes:
<option value="">---------</option>
What I would like to know:
Looking for a solution, I came across Django ticket 4653 , which gave me the impression that others had the same question and that the default behavior Perhaps Django was changed. This ticket is older than a year, so I was hoping there might be a cleaner way to accomplish these things.
Thanks for any help,
Jeff
Edit: I configured the ForeignKey field as such:
verb = models.ForeignKey(Verb, blank=False, default=get_default_verb)
This sets the default value so that it is no longer the empty / dashes parameter, but unfortunately this does not seem to solve my questions. That is, the empty / dashes parameter is still displayed in the list.
python django django-models django-forms
jlpp Apr 11 '09 at 0:43 2009-04-11 00:43
source share