Code

Opened 3 years ago

Closed 3 years ago

#17306 closed Bug (invalid)

Forms.BooleanField always fails with "Field Required" when value is false False

Reported by: anonymous Owned by: nobody
Component: Forms Version: master
Severity: Normal Keywords: boolean, none, False
Cc: Triage Stage: Unreviewed
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: yes UI/UX: no

Description

In forms.py

This line:
658 if not value and self.required:

Should be:
if value is None and self.required

Otherwise False values for BooleanFields will trigger this, when there is a value for the field, but that value is False.

Attachments (0)

Change History (1)

comment:1 Changed 3 years ago by Alex

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

It is intentional that a false value triggers this error, see #5957.

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.