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
This commit is contained in:
Malcolm Tredinnick 2007-09-15 14:03:07 +00:00
parent e582777eae
commit 9d18227a56
1 changed files with 4 additions and 0 deletions

View File

@ -452,6 +452,10 @@ class BooleanField(Field):
def clean(self, value):
"Returns a Python boolean object."
super(BooleanField, self).clean(value)
# Explicitly check for the string '0', which is what as hidden field
# will submit for False.
if value == '0':
return False
return bool(value)
class NullBooleanField(BooleanField):