Opened 11 years ago

Closed 11 years ago

#5959 closed (fixed)

BooleanField should clean the string 'False' to boolean False

Reported by: Chris Beaven 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 Chris Beaven 11 years ago.

Download all attachments as: .zip

Change History (3)

Changed 11 years ago by Chris Beaven

Attachment: boolean_hidden.diff added

comment:1 Changed 11 years ago by Chris Beaven

Triage Stage: UnreviewedReady 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 11 years ago by Malcolm Tredinnick

Resolution: fixed
Status: newclosed

(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