#7753: NullBooleanField does not clean data correctly when
widget=forms.HiddenInput
-----------------------------+----------------------------------------------
 Reporter:  ElliottM         |       Owner:  nobody    
   Status:  new              |   Milestone:  1.0       
Component:  django.newforms  |     Version:  SVN       
 Keywords:                   |       Stage:  Unreviewed
Has_patch:  1                |  
-----------------------------+----------------------------------------------
 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.

-- 
Ticket URL: <http://code.djangoproject.com/ticket/7753>
Django Code <http://code.djangoproject.com/>
The web framework for perfectionists with deadlines
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to