Opened 12 years ago

Closed 12 years ago

#8676 closed (wontfix)

BooleanField says value required if False

Reported by: Bernd Dorn Owned by: nobody
Component: Uncategorized Version: master
Severity: Keywords: forms
Cc: Triage Stage: Unreviewed
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no


The BooleanField should accept False values and not raise the required error. Here is a diff from the branch. The problem is in trunk too.

Index: django/forms/
--- django/forms/	(revision 8696)
+++ django/forms/	(working copy)
@@ -569,9 +569,9 @@
         if value == 'False':
             value = False
-            value = bool(value)
+            value = value and True or None
         super(BooleanField, self).clean(value)
-        if not value and self.required:
+        if value is None and self.required:
             raise ValidationError(self.error_messages['required'])
         return value

Change History (1)

comment:1 Changed 12 years ago by Daniel Pope <dan@…>

Resolution: wontfix
Status: newclosed

The opposite behaviour was decided in #5957.

Note: See TracTickets for help on using tickets.
Back to Top