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:
parent
e582777eae
commit
9d18227a56
|
@ -452,6 +452,10 @@ class BooleanField(Field):
|
||||||
def clean(self, value):
|
def clean(self, value):
|
||||||
"Returns a Python boolean object."
|
"Returns a Python boolean object."
|
||||||
super(BooleanField, self).clean(value)
|
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)
|
return bool(value)
|
||||||
|
|
||||||
class NullBooleanField(BooleanField):
|
class NullBooleanField(BooleanField):
|
||||||
|
|
Loading…
Reference in New Issue