observer package¶
Subpackages¶
- observer.tests package
- observer.utils package
- observer.watchers package
Submodules¶
observer.conf module¶
observer.decorators module¶
observer.investigator module¶
-
class
observer.investigator.
Investigator
(model, include=None, exclude=None)[source]¶ Bases:
object
A model modification investigator
Create an instance of investigator with a model class and call ‘prepare’ method just before save the model. After the model is saved, call ‘investigate’ method and the method will yields the field names modified.
-
get_cached
(pk, ignore_exception=True)[source]¶ Get cached object
Parameters: - pk (any) – A primary key of the object
- ignore_exception (bool) – Return None if the object is not found, if this is False, ObjectDoesNotExist raised
Raises: ObjectDoesNotExist
– When a specified object does not exists in the cache and ignore_exception is False.Returns: object or None
-
get_object
(pk, ignore_exception=True)[source]¶ Get latest object
It try to get the latest (unsaved) object from the database. If ignore_exception is True, return None, otherwise it raise ObjectDoesNotExist exception when no object is found.
Parameters: - pk (any) – A primary key of the object
- ignore_exception (bool) – Return None if the object is not found. if this is False, ObjectDoesNotExist raised.
Raises: ObjectDoesNotExist
– When a specified object does not exists ignore_exception is False.Returns: object or None
-