﻿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
4653	form_for_instance generates empty choice for non-blank CharField with options	Ilya Semenov <semenov@…>	nobody	"Given a model with a non-blank CharField with some options:
{{{
class Settings(models.Model):
    notification = models.CharField(maxlength=20, choices=(('foo','Foo'),('bar','Bar'))
}}}

create a form:
{{{
s = Settings.objects.get(...)
Form = forms.form_for_instance(s)
form = Form()
}}}

and display it in the template:
{{{
{{ form.notification }}
}}}

The select widget will have an empty choice ""-----------"", though the field doesn't allow blank values by its definition. 

Another situation is when the field actually allows blanks, moreover, it provides its own blank value in the options:
{{{
class Settings(models.Model):
    notification = models.CharField(maxlength=20, blank=True, choices=(('foo','Foo'),('bar','Bar'),('', '- none of the above -'))
}}}

In this case, the select widget will also have an empty choice ""-----------"", and having two empty choices is quite confusing confusing.

The proposed patch resolves both issues."		closed	Forms	dev		fixed	form_for_instance CharField options blank	real.human@… simon@…	Ready for checkin	1	0	0	0	0	0
