Opened 8 years ago

Closed 8 years ago

#7500 closed (duplicate)

Empty Boolean Field Does Not Raise Validation Error When Required

Reported by: Alex Gaynor Owned by: nobody
Component: Forms Version: master
Severity: Keywords:
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: yes
Easy pickings: UI/UX:

Description

The boolean field doesn't raise a ValidationError when it is required and no data is input. This is because BooleanField's clean method(and it's widget), evaluate to either True or False, False used to evaluate to None, and False was left out of the EMPTY_VALUES list, which is what is checked to see if a field needs to raise a validation error when a field is required.

Attachments (1)

bool.diff (1.7 KB) - added by Alex Gaynor 8 years ago.
This breaks one test because a test that used to raise "Value not in options" now raises "this field is required", not sure what the fix for that is.

Download all attachments as: .zip

Change History (3)

Changed 8 years ago by Alex Gaynor

Attachment: bool.diff added

This breaks one test because a test that used to raise "Value not in options" now raises "this field is required", not sure what the fix for that is.

comment:1 Changed 8 years ago by Alex Gaynor

Has patch: set
Patch needs improvement: set
Triage Stage: UnreviewedAccepted

comment:2 Changed 8 years ago by Alex Gaynor

Resolution: duplicate
Status: newclosed

Marking as a dupe of #5957, I am an idiot.

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