mirror of
https://github.com/django/django.git
synced 2025-10-26 07:06:08 +00:00
Fixed #11860. Changed NullBooleanSelect's _has_changed method to repect differences between None and False. Thanks, matiasb.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@12523 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
@@ -452,9 +452,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=()):
|
||||
|
||||
Reference in New Issue
Block a user