(self, initial, data)
Detects if the data was changed. This is added in 1.6.
Detects if the data was changed. This is added in 1.6.
Detects if the data was changed . This is added in 1 . 6 .
def has_changed(self, initial, data):
        "Detects if the data was changed. This is added in 1.6."
        # Always return False if the field is disabled since self.bound_data
        # always uses the initial value in this case.
        if self.disabled:
            return False
        if initial is None and data is None:
            return False
        if data and not hasattr(data, '__iter__'):
            data = self.widget.decompress(data)
        initial = self.to_python(initial)
        data = self.to_python(data)
        if hasattr(self, '_coerce'):
            data = self._coerce(data)
        if isinstance(data, Model) and isinstance(initial, Model):
            return model_vars(data) != model_vars(initial)
        else:
            return data != initial
def has_changed ( self , initial , data ) : # Always return False if the field is disabled since self.bound_data # always uses the initial value in this case. if self . disabled : return False if initial is None and data is None : return False if data and not hasattr ( data , '__iter__' ) : data = self . widget . decompress ( data ) initial = self . to_python ( initial ) data = self . to_python ( data ) if hasattr ( self , '_coerce' ) : data = self . _coerce ( data ) if isinstance ( data , Model ) and isinstance ( initial , Model ) : return model_vars ( data ) != model_vars ( initial ) else : return data != initial