Opened 8 years ago

Closed 8 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:


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 8 years ago.

Download all attachments as: .zip

Change History (3)

Changed 8 years ago by SmileyChris

comment:1 Changed 8 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 8 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,

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