Submitted ticket #8663 for the following: When a ModelForm? is used to display a form for a Model, the fields defined with a choices option insert a "-------" value for the first option when the form is rendered. If you override a field and manually specify the choices for a Select widget, this "-------" does not appear as the first choice.
# models.py from django.db import models MY_CHOICES = ( (0, 'Zero'), (1, 'One'), ) class MyModel(models.Model): my_field = models.IntegerField(choices=MY_CHOICES) # forms.py from django import forms from myapp.models import MyModel, MY_CHOICES class MyModelForm(forms.ModelForm): #my_field = forms.IntegerField(widget=forms.Select(choices=MY_CHOICES)) class Meta: model = MyModel View the HTML for the form with my_field commented out: >>> from myapp.forms import MyModelForm >>> f = MyModelForm() >>> print f <tr><th><label for="id_my_field">My field:</label></th><td><select name="my_field" id="id_my_field"> <option value="" selected="selected">---------</option> <option value="0">Zero</option> <option value="1">One</option> </select></td></tr> Now uncomment my_field in MyModelForm?: >>> from myapp.forms import MyModelForm >>> f = MyModelForm() >>> print f <tr><th><label for="id_my_field">My field:</label></th><td><select name="my_field" id="id_my_field"> <option value="0">Zero</option> <option value="1">One</option> </select></td></tr> This value doesn't appear in the 2nd case: <option value="" selected="selected">---------</option> SVN-8643 --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---