Code

Opened 6 years ago

Closed 6 years ago

#7500 closed (duplicate)

Empty Boolean Field Does Not Raise Validation Error When Required

Reported by: Alex 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 6 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 6 years ago by Alex

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 6 years ago by Alex

  • Has patch set
  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement set
  • Triage Stage changed from Unreviewed to Accepted

comment:2 Changed 6 years ago by Alex

  • Resolution set to duplicate
  • Status changed from new to closed

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

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.