diff options
| author | Joseph Kocherhans <joseph@jkocherhans.com> | 2010-02-23 14:20:35 +0000 |
|---|---|---|
| committer | Joseph Kocherhans <joseph@jkocherhans.com> | 2010-02-23 14:20:35 +0000 |
| commit | fd0c3656907f06d860ed7bb07daa1ae2c5bf9e11 (patch) | |
| tree | b7b809bc7eed841421f45064319add0bc02a010d /django | |
| parent | cda48e9f0ba20ef993379001a0f94a479fbf23cb (diff) | |
[1.1.X] Fixed #11860. Changed NullBooleanSelect's _has_changed method to repect differences between None and False. Backport of [12523] from trunk.
git-svn-id: http://code.djangoproject.com/svn/django/branches/releases/1.1.X@12524 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'django')
| -rw-r--r-- | django/forms/widgets.py | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/django/forms/widgets.py b/django/forms/widgets.py index 47ed684fbb..a759581205 100644 --- a/django/forms/widgets.py +++ b/django/forms/widgets.py @@ -454,9 +454,13 @@ class NullBooleanSelect(Select): False: False}.get(value, None) def _has_changed(self, initial, data): - # Sometimes data or initial could be None or u'' which should be the - # same thing as False. - return bool(initial) != bool(data) + # For a NullBooleanSelect, None (unknown) and False (No) + # are not the same + if initial is not None: + initial = bool(initial) + if data is not None: + data = bool(data) + return initial != data class SelectMultiple(Select): def render(self, name, value, attrs=None, choices=()): |
