diff --git a/django/newforms/fields.py b/django/newforms/fields.py
index dfe46a2..337a689 100644
a
|
b
|
class BooleanField(Field):
|
535 | 535 | |
536 | 536 | def clean(self, value): |
537 | 537 | """Returns a Python boolean object.""" |
| 538 | if value == 'False': |
| 539 | value = False |
538 | 540 | super(BooleanField, self).clean(value) |
539 | 541 | # Explicitly check for the string 'False', which is what a hidden field |
540 | 542 | # will submit for False. Because bool("True") == True, we don't need to |
541 | 543 | # handle that explicitly. |
542 | | if value == 'False': |
543 | | return False |
| 544 | if not value and self.required: |
| 545 | raise ValidationError(self.error_messages['required']) |
544 | 546 | return bool(value) |
545 | 547 | |
546 | 548 | class NullBooleanField(BooleanField): |
diff --git a/tests/regressiontests/forms/fields.py b/tests/regressiontests/forms/fields.py
index f3b6a96..207ff80 100644
a
|
b
|
ValidationError: [u'This field is required.']
|
937 | 937 | >>> f.clean(True) |
938 | 938 | True |
939 | 939 | >>> f.clean(False) |
940 | | False |
| 940 | Traceback (most recent call last): |
| 941 | ... |
| 942 | ValidationError: [u'This field is required.'] |
941 | 943 | >>> f.clean(1) |
942 | 944 | True |
943 | 945 | >>> f.clean(0) |
944 | | False |
| 946 | Traceback (most recent call last): |
| 947 | ... |
| 948 | ValidationError: [u'This field is required.'] |
945 | 949 | >>> f.clean('Django rocks') |
946 | 950 | True |
947 | 951 | |
948 | 952 | >>> f.clean('True') |
949 | 953 | True |
950 | 954 | >>> f.clean('False') |
951 | | False |
| 955 | Traceback (most recent call last): |
| 956 | ... |
| 957 | ValidationError: [u'This field is required.'] |
952 | 958 | |
953 | 959 | >>> f = BooleanField(required=False) |
954 | 960 | >>> f.clean('') |