diff options
author | Étienne Loks <etienne.loks@iggdrasil.net> | 2016-01-17 18:09:26 +0100 |
---|---|---|
committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2016-01-17 18:09:26 +0100 |
commit | f384337ef0d9d2e40d09204f18c4a486e925132c (patch) | |
tree | 434a8a1ee961aa3adf79b35fe42ac41f075b50ef /django-simple-history/simple_history/__init__.py | |
parent | ad4a7e6015c26fef5bbad4783d638a138e687bdb (diff) | |
download | Ishtar-f384337ef0d9d2e40d09204f18c4a486e925132c.tar.bz2 Ishtar-f384337ef0d9d2e40d09204f18c4a486e925132c.zip |
Include django-simple-history - fix install script
Diffstat (limited to 'django-simple-history/simple_history/__init__.py')
-rwxr-xr-x | django-simple-history/simple_history/__init__.py | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/django-simple-history/simple_history/__init__.py b/django-simple-history/simple_history/__init__.py new file mode 100755 index 000000000..6df0b60b6 --- /dev/null +++ b/django-simple-history/simple_history/__init__.py @@ -0,0 +1,22 @@ +import models + + +registered_models = {} + + +def register(model, app=None, manager_name='history'): + """ + Create historical model for `model` and attach history manager to `model`. + + Keyword arguments: + app -- App to install historical model into (defaults to model.__module__) + manager_name -- class attribute name to use for historical manager + + This method should be used as an alternative to attaching an + `HistoricalManager` instance directly to `model`. + """ + if not model in registered_models: + records = models.HistoricalRecords() + records.manager_name = manager_name + records.module = ("%s.models" % app) or model.__module__ + records.finalize(model) |