﻿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
7753	NullBooleanField does not clean data correctly when widget=forms.HiddenInput	ElliottM	nobody	"Consider the following snippet of a forms.py file:
{{{
class TestForm(forms.Form):
    null_bool=forms.NullBooleanField(widget=forms.HiddenInput, initial=True)
}}}

In django.newforms.widgets, the NullBooleanSelect widget normalizes all the input to either True, False, or None. Up until now, the nullBooleanField.clean() method has expected the input to be in one of these three forms. 

However, when a HiddenInput widget is used, that normalization is bypassed, and the NullBooleanfield.clean() method receives a string. In the case I meantioned above, the string would be 'True'. In the (non-null) BooleanField.clean() method, specific tests are done for this, but they're not done in the NullBooleanField.clean() method, and I believe they should be.

A patch is included, with tests.

For convenience, 
http://code.djangoproject.com/browser/django/trunk/django/newforms/widgets.py#L226 - NullBooleanSelect widget
http://code.djangoproject.com/browser/django/trunk/django/newforms/fields.py#L560  - Booleanfield field, with the NullBooleanfield defined right below.

"		closed	Forms	dev		fixed			Accepted	1	0	0	1	0	0
