- def __init__(self, *args, **kwargs):
- super(BaseModel, self).__init__(*args, **kwargs)
- self._original_state = dict([(k, v) for k,v in self.__dict__.items() if not k in kwargs])
-
- @classmethod
- def cache_key(cls, pk):
- return '%s.%s:%s' % (settings.APP_URL, cls.__name__, pk)
-
- def get_dirty_fields(self):
- missing = object()
- return dict([(k, self._original_state.get(k, None)) for k,v in self.__dict__.items()
- if self._original_state.get(k, missing) == missing or self._original_state[k] != v])