Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Moved BooleanField 'required' validation in validate()

  • Loading branch information...
commit d18893d5ce083b357fa1c43cafb56908c5a14a0e 1 parent 55416e2
@claudep claudep authored
Showing with 3 additions and 2 deletions.
  1. +3 −2 django/forms/fields.py
View
5 django/forms/fields.py
@@ -665,10 +665,11 @@ def to_python(self, value):
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
Please sign in to comment.
Something went wrong with that request. Please try again.