Opened 9 years ago
Closed 9 years ago
#26534 closed Bug (fixed)
has_changed For BooleanField and NullBooelanField always returns True with HiddenInput
Reported by: | David Sanders | Owned by: | nobody |
---|---|---|---|
Component: | Forms | Version: | dev |
Severity: | Normal | Keywords: | has_changed BooleanField |
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
The current implementation of has_changed
for both forms.BooleanField
and forms.NullBooleanField
will always return True if a HiddenInput
is used because the raw value is "True" or "False" and has_changed
isn't running to_python
before comparing them.
I've got a pull request that adds test coverage and fixes the issue by running the data
to has_changed
through to_python
before comparing to the initial value. This should cover other widgets beyond HiddenInput
as long as they return a value understood by to_python
for forms.BooleanField
and forms.NullBooleanField
.
Change History (3)
comment:1 by , 9 years ago
Version: | 1.8 → master |
---|
comment:2 by , 9 years ago
Triage Stage: | Unreviewed → Ready for checkin |
---|
PR