Add proper _has_changed for HiddenInput

Fixes #45
This commit is contained in:
Michal Ociepka 2013-06-12 16:43:30 +02:00
parent 677d817abf
commit ddbbb6a98c

View file

@ -300,6 +300,16 @@ class MultipleSelect2HiddenInput(forms.TextInput):
return data.getlist(name)
return data.get(name, None)
def _has_changed(self, initial, data):
if initial is None:
initial = []
if data is None:
data = []
if len(initial) != len(data):
return True
initial_set = set([force_unicode(value) for value in initial])
data_set = set([force_unicode(value) for value in data])
return data_set != initial_set
### Heavy mixins and widgets ###
@ -356,7 +366,7 @@ class HeavySelect2Mixin(Select2Mixin):
3. Otherwise, check the cached results. When the user searches in the fields then all the returned
responses from server, which has the value and label mapping, are cached by ``heavy_data.js``.
:type userGetValTextFuncName: :py:obj:`str`
.. tip:: Since version 3.2.0, cookies or localStorage are no longer checked or used. All