Django

Code

Ticket #5959 (closed: fixed)

Opened 1 year ago

Last modified 11 months ago

BooleanField should clean the string 'False' to boolean False

Reported by: SmileyChris Assigned to: nobody
Milestone: Component: Forms
Version: SVN Keywords:
Cc: Triage Stage: Ready for checkin
Has patch: 1 Needs documentation: 0
Needs tests: 0 Patch needs improvement: 0

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

boolean_hidden.diff (2.2 kB) - added by SmileyChris on 11/15/07 20:57:31.

Change History

11/15/07 20:57:31 changed by SmileyChris

  • attachment boolean_hidden.diff added.

11/15/07 20:59:03 changed by SmileyChris

  • needs_better_patch changed.
  • stage changed from Unreviewed to Ready for checkin.
  • needs_tests changed.
  • needs_docs changed.

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.

11/29/07 13:22:04 changed by mtredinnick

  • status changed from new to closed.
  • resolution set to fixed.

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


Add/Change #5959 (BooleanField should clean the string 'False' to boolean False)




Change Properties
Action