'Register a function to call on save or update to respond to changes.
For example::
def watch_status(old_attr={}, new_attr={},
instance=None, sender=None, **kw):
if old_attr.get(\'status\') != new_attr.get(\'status\'):
new_instance.save(_signal=False)
TheModel.on_change(watch_status)
.. note::
Any call to instance.save() or instance.update() within a callback
will not trigger any change handlers.
.. note::
Duplicates based on function.__name__ are ignored for a given
class.'

@classmethod
def on_change(cls, callback):

    existing = _on_change_callbacks.get(cls, [])
    if (callback.__name__ in [e.__name__ for e in existing]):
        return callback
    _on_change_callbacks.setdefault(cls, []).append(callback)
    return callback
