From d18893d5ce083b357fa1c43cafb56908c5a14a0e Mon Sep 17 00:00:00 2001 From: Claude Paroz Date: Sat, 26 Jan 2013 16:39:20 +0100 Subject: [PATCH] Moved BooleanField 'required' validation in validate() --- django/forms/fields.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/django/forms/fields.py b/django/forms/fields.py index 1e9cbcb4d9..6442eadf95 100644 --- a/django/forms/fields.py +++ b/django/forms/fields.py @@ -665,10 +665,11 @@ class BooleanField(Field): value = False else: value = bool(value) - value = super(BooleanField, self).to_python(value) + return super(BooleanField, self).to_python(value) + + def validate(self, value): if not value and self.required: raise ValidationError(self.error_messages['required']) - return value def _has_changed(self, initial, data): # Sometimes data or initial could be None or '' which should be the