Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Fixed #5471 -- Fixed cleaning of boolean field data when it's used as…

… a hidden field. Patch from Paul Lanier.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@6285 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit 9d18227a56a2b23d065dcf73c119ec3273ed2318 1 parent e582777
Malcolm Tredinnick authored September 15, 2007

Showing 1 changed file with 4 additions and 0 deletions. Show diff stats Hide diff stats

  1. 4  django/newforms/fields.py
4  django/newforms/fields.py
@@ -452,6 +452,10 @@ class BooleanField(Field):
452 452
     def clean(self, value):
453 453
         "Returns a Python boolean object."
454 454
         super(BooleanField, self).clean(value)
  455
+        # Explicitly check for the string '0', which is what as hidden field
  456
+        # will submit for False.
  457
+        if value == '0':
  458
+            return False
455 459
         return bool(value)
456 460
 
457 461
 class NullBooleanField(BooleanField):

0 notes on commit 9d18227

Please sign in to comment.
Something went wrong with that request. Please try again.