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.