Opened 16 years ago

Closed 16 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: dev
Severity: Keywords:
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: yes
Easy pickings: no UI/UX: no

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 16 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)

by Alex Gaynor, 16 years ago

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 by Alex Gaynor, 16 years ago

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

comment:2 by Alex Gaynor, 16 years ago

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