Opened 17 years ago

Closed 17 years ago

#5959 closed (fixed)

BooleanField should clean the string 'False' to boolean False

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

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 Chris Beaven 17 years ago.

Download all attachments as: .zip

Change History (3)

by Chris Beaven, 17 years ago

Attachment: boolean_hidden.diff added

comment:1 by Chris Beaven, 17 years ago

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 by Malcolm Tredinnick, 17 years ago

Resolution: fixed
Status: newclosed

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

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