﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
8663	Inconsistencies/Bug in ModelForm	lingrlongr	nobody	"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"		closed	Forms	dev		wontfix	ModelForm forms		Design decision needed	0	0	0	0	0	0
