This is a pre-production deployment of Warehouse, however changes made here WILL affect the production instance of PyPI.
Latest Version Dependencies status unknown Test status unknown Test coverage unknown
Project Description
=====
Django Model History
=====

The package is designed to track changes in object models. It has the ability to roll back changes to the object and attempt to restore an object if it has been deleted.
If the change of the object were conducted script or from the console, the user field will be empty.

=====
Quick start
=====
0. Install::

pip install django-model-history2

1. Add in INSTALLED_APPS::

INSTALLED_APPS = (
...
'model_history'
)

3. Make migrate::

python manage.py migrate model_history

4. Add decorator model_hisotry to your Model class:

.. code-block:: python

from model_history.decorators import model_history

@model_history()
class SomeModel(models.Model):
field_one = models.CharField()
last_modified = models.DateTimeField()


=====
Arguments for decorator model_history
=====
1. ``exclude`` - Exclude fields. Default: []::

@model_hisotry(exclude=['last_modified'])

2. ``related`` - Track all related models. Default: False::

@model_history(exclude=['last_modified'], related=True)

3. ``related_exclude`` - Exclude for related models. Default: []::

@model_history(exclude=['last_modified'], related=True, related_exclude=['myapp.models.Model2'])

=====
Settings
=====
1. The settings are defined in the dictionary named ``MODEL_HISTORY_SETTINGS``::

MODEL_HISTORY_SETTINGS = {
'connect': [
{'model': 'django.contrib.auth.models.User', 'exclude': ['last_login'], 'related': True, 'related_exclude': ['django.contrib.admin.models.LogEntry']}
]
}
2. Models are listed in parameter ``connect`` will be put on track, with the specified parameters.
3. ``delete_action`` - Should be in the admin interface function "delete selected objects". Default: False::

MODEL_HISTORY_SETTINGS = {
'delete_action': True
'connect': [
{'model': 'django.contrib.auth.models.User', 'exclude': ['last_login'], 'related': True, 'related_exclude': ['django.contrib.admin.models.LogEntry']}
]
}
4. ``delete_permission`` - Which option is the user to check for compliance with the availability of the right to delete entries from the history::

MODEL_HISTORY_SETTINGS = {
'delete_action': True,
'delete_permission': 'is_superuser',
'connect': [
{'model': 'django.contrib.auth.models.User', 'exclude': ['last_login'], 'related': True, 'related_exclude': ['django.contrib.admin.models.LogEntry']}
]
}
5. ``revert_action`` - Should be in the admin function "Revert". This function tries to make changes or cancellation recover a deleted object from the dump. Default: True::

MODEL_HISTORY_SETTINGS = {
'delete_action': True,
'delete_permission': 'is_superuser',
'revert_action': True,
'connect': [
{'model': 'django.contrib.auth.models.User', 'exclude': ['last_login'], 'related': True, 'related_exclude': ['django.contrib.admin.models.LogEntry']}
]
}
6. ``revert_permission`` - Which option is the user to check for compliance with the availability of rights to recovery facility::

MODEL_HISTORY_SETTINGS = {
'delete_action': True,
'delete_permission': 'is_superuser',
'revert_action': True,
'revert_permission': 'is_superuser',
'connect': [
{'model': 'django.contrib.auth.models.User', 'exclude': ['last_login'], 'related': True, 'related_exclude': ['django.contrib.admin.models.LogEntry']}
]
}

=====
Changelist
=====
* 0.9.3:

* Add ``track_created`` in ``MODEL_HISTORY_SETTINGS`` for tracking new object created. Default: False.
* Add ``dispatch_uid`` for connected signals.
* Model ``History`` small refactoring.

* 0.9.2:

* Refactor settings import
Release History

Release History

0.9.3

This version

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.9.2

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.9.1

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.9.0

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

Download Files

Download Files

TODO: Brief introduction on what you do with files - including link to relevant help section.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
django-model-history2-0.9.3.zip (13.6 kB) Copy SHA256 Checksum SHA256 Source Nov 17, 2015

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS HPE HPE Development Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting