Opened 8 years ago

Closed 8 years ago

#8676 closed (wontfix)

BooleanField says value required if False

Reported by: dobee 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: UI/UX:


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 8 years ago by Daniel Pope <dan@…>

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Resolution set to wontfix
  • Status changed from new to closed

The opposite behaviour was decided in #5957.

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