#26534: has_changed For BooleanField and NullBooelanField always returns True
with
HiddenInput
----------------------------+--------------------------------------
Reporter: dsanders11 | Owner: nobody
Type: Bug | Status: new
Component: Forms | Version: 1.8
Severity: Normal | Keywords: has_changed BooleanField
Triage Stage: Unreviewed | Has patch: 1
Easy pickings: 0 | UI/UX: 0
----------------------------+--------------------------------------
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 [https://github.com/django/django/pull/6483 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`.
--
Ticket URL: <https://code.djangoproject.com/ticket/26534>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/053.d4abdb39acc216cc2101be5f504895d8%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.