Code

Opened 7 years ago

Closed 7 years ago

#5959 closed (fixed)

BooleanField should clean the string 'False' to boolean False

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

Description

Currently the comment says:

# Explicitly check for the string '0', which is what as hidden field
# will submit for False. 

But that's just blatantly incorrect, the HiddenInput widget submits the string 'False' for False.

There are a couple of solutions here, I have chosen the first in the initial patch, due to the fact it's in-line with what happens already:

  1. The BooleanField should clean 'False' to False
  1. The HiddenInput should render False as ''
  1. A new HiddenBooleanInput widget should be created and linked to BooleanField.hidden_widget (ugh)

Attachments (1)

boolean_hidden.diff (2.2 KB) - added by SmileyChris 7 years ago.

Download all attachments as: .zip

Change History (3)

Changed 7 years ago by SmileyChris

comment:1 Changed 7 years ago by SmileyChris

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Triage Stage changed from Unreviewed to Ready for checkin

I'll promote to checkin because I'm pretty sure option 1 is the right course of action. If the committer has any concerns that I haven't chosen the correct solution, kick it back.

comment:2 Changed 7 years ago by mtredinnick

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

(In [6745]) Fixed #5959 -- Fixed handling of False values in hidden boolean fields. Thanks,
SmileyChris.

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.