diff --git a/django/forms/fields.py b/django/forms/fields.py index e3299c07aa..a5ea81d4b6 100644 --- a/django/forms/fields.py +++ b/django/forms/fields.py @@ -605,7 +605,7 @@ class BooleanField(Field): # will submit for False. Also check for '0', since this is what # RadioSelect will provide. Because bool("True") == bool('1') == True, # we don't need to handle that explicitly. - if value in ('False', '0'): + if isinstance(value, basestring) and value.lower() in ('false', '0'): value = False else: value = bool(value) diff --git a/tests/regressiontests/forms/tests/fields.py b/tests/regressiontests/forms/tests/fields.py index 59c761c76d..2303b4e9db 100644 --- a/tests/regressiontests/forms/tests/fields.py +++ b/tests/regressiontests/forms/tests/fields.py @@ -698,6 +698,8 @@ class FieldsTests(TestCase): self.assertEqual(False, f.clean('0')) self.assertEqual(True, f.clean('Django rocks')) self.assertEqual(False, f.clean('False')) + self.assertEqual(False, f.clean('false')) + self.assertEqual(False, f.clean('FaLsE')) # ChoiceField #################################################################