Opened 9 years ago

Closed 9 years ago

#5471 closed (fixed)

BooleanField fails to work when processing data from as_hidden

Reported by: Paul Lanier <planier@…> Owned by: nobody
Component: Forms Version: master
Severity: Keywords: BooleanField as_hidden
Cc: Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

If a BooleanField is referenced in the Template with .as_hidden then the returned value for False is '0'. Since BooleanField does a simple bool() in clean, this is converted to True.

The patch adds an explicit check for '0' and returns false in this case.

Attachments (1)

newforms_fields_py.patch (526 bytes) - added by Paul Lanier <planier@…> 9 years ago.
Patch for newforms/fields.py

Download all attachments as: .zip

Change History (3)

Changed 9 years ago by Paul Lanier <planier@…>

Attachment: newforms_fields_py.patch added

Patch for newforms/fields.py

comment:1 Changed 9 years ago by planier

Triage Stage: UnreviewedReady for checkin

comment:2 Changed 9 years ago by Malcolm Tredinnick

Resolution: fixed
Status: newclosed

(In [6285]) Fixed #5471 -- Fixed cleaning of boolean field data when it's used as a hidden field. Patch from Paul Lanier.

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