[Django] #26534: has_changed For BooleanField and NullBooelanField always returns True with HiddenInput

9 views
Skip to first unread message

Django

unread,
Apr 23, 2016, 7:12:48 PM4/23/16
to django-...@googlegroups.com
#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.

Django

unread,
Apr 23, 2016, 7:17:13 PM4/23/16
to django-...@googlegroups.com
#26534: has_changed For BooleanField and NullBooelanField always returns True with
HiddenInput
-------------------------------------+-------------------------------------

Reporter: dsanders11 | Owner: nobody
Type: Bug | Status: new
Component: Forms | Version: master
Severity: Normal | Resolution:
Keywords: has_changed | Triage Stage:
BooleanField | Unreviewed
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by charettes):

* needs_better_patch: => 0
* version: 1.8 => master
* needs_tests: => 0
* needs_docs: => 0


Comment:

[https://github.com/django/django/pull/6483 PR]

--
Ticket URL: <https://code.djangoproject.com/ticket/26534#comment:1>

Django

unread,
Apr 24, 2016, 2:59:10 PM4/24/16
to django-...@googlegroups.com
#26534: has_changed For BooleanField and NullBooelanField always returns True with
HiddenInput
-------------------------------------+-------------------------------------

Reporter: dsanders11 | Owner: nobody
Type: Bug | Status: new
Component: Forms | Version: master
Severity: Normal | Resolution:
Keywords: has_changed | Triage Stage: Ready for
BooleanField | checkin

Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by charettes):

* stage: Unreviewed => Ready for checkin


--
Ticket URL: <https://code.djangoproject.com/ticket/26534#comment:2>

Django

unread,
Apr 24, 2016, 3:06:40 PM4/24/16
to django-...@googlegroups.com
#26534: has_changed For BooleanField and NullBooelanField always returns True with
HiddenInput
-------------------------------------+-------------------------------------
Reporter: dsanders11 | Owner: nobody
Type: Bug | Status: closed
Component: Forms | Version: master
Severity: Normal | Resolution: fixed

Keywords: has_changed | Triage Stage: Ready for
BooleanField | checkin
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Simon Charette <charettes@…>):

* status: new => closed
* resolution: => fixed


Comment:

In [changeset:"218175b09d244b9c7c84c2f2d5f478297251bbe9" 218175b0]:
{{{
#!CommitTicketReference repository=""
revision="218175b09d244b9c7c84c2f2d5f478297251bbe9"
Fixed #26534 -- Fixed boolean form fields has_changed() with hidden input.
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/26534#comment:3>

Reply all
Reply to author
Forward
0 new messages