Package for easy creation of audit logs in Django projects
Project description
Django Auditor Logs is a Django app that provides a simple way to log events CREATE, UPDATE AND DELETE in your Django project. It is designed to be used with the Graphene Django package or Django Graphbox, but can be used with any Django project.
Installation
pip install django-auditor-logs
Quick start
- Add “django_auditor_logs” to your INSTALLED_APPS setting like this::
INSTALLED_APPS = [ ... 'django_auditor_logs', ]
- Configure AUDIT_APPS in your settings.py file like this::
AUDIT_APPS = [ 'app1', 'app2', ]
Run python manage.py migrate to create the django_auditor_logs models.
- Optionally you can change MIGRATION_MODULES in your settings.py file like this::
MIGRATION_MODULES = { 'django_auditor_logs': 'app1.migrations', }
User and request metadare must be added on __user_metadata__ and __request_metadata__ fields in the model instance. On Django Graphbox from 1.1.0 version, this fields are added automatically.
There is a decorator to set user and request metadata on the model instance when it use Graphene Django uson a session_manager authentication style. the decorator set_metadata_mutation(model=None, id_field_name=None, session_manager=None, validate_method_name=None, index_tuple_user_session=0) must be used on the mutation class. The decorator parameters are:
model: The model class to set metadata.
id_field_name: The id field name of the model class ( same as the argument of Mutation that points to the id field of the model class)
session_manager: The session manager class to validate session and has a validation method that returns a tuple with the user instance.
validate_method_name: The method name to validate the session.
index_tuple_user_session: The index of the tuple returned by the session_manager.validate_method_name method that contains the user instance.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for django_auditor_logs-1.0.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8d356bb6eaf879da49204d2274e2ee5e67cafe25d8acbb1d433b7caf6f3db272 |
|
MD5 | eec2ddee85c27236211eb2e1d898589c |
|
BLAKE2b-256 | d6d7260b8123a69f16eff6c365e61cc7eba73172e6fc4acfcdf82c5efbd8bde1 |
Hashes for django_auditor_logs-1.0.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | df1fa5481677f3fe5e8bf10a4e6a5efa7905b3033986bc2aac7b80a122e34205 |
|
MD5 | b21bcb4ee69d7d23beb92ff66608c6a5 |
|
BLAKE2b-256 | 0785e81f7205473ceece157b4062d91776f7905eaa86915bc2d0b778408646f7 |