mirror of
https://github.com/django/django.git
synced 2025-10-30 00:56:09 +00:00
Fixed #24844 -- Corrected has_changed implementation for HStoreField.
Backport of 43b2d88a5b from master
This commit is contained in:
committed by
Tim Graham
parent
2aa2b9f291
commit
62c19a21b6
@@ -34,3 +34,13 @@ class HStoreField(forms.CharField):
|
||||
for key, val in value.items():
|
||||
value[key] = six.text_type(val)
|
||||
return value
|
||||
|
||||
def has_changed(self, initial, data):
|
||||
"""
|
||||
Return True if data differs from initial.
|
||||
"""
|
||||
# For purposes of seeing whether something has changed, None is
|
||||
# the same as an empty dict, if the data or initial value we get
|
||||
# is None, replace it w/ {}.
|
||||
initial_value = self.to_python(initial)
|
||||
return super(forms.HStoreField, self).has_changed(initial_value, data)
|
||||
|
||||
Reference in New Issue
Block a user