Django Audit Trail
Audit trail is a simple Django app to track the database changes and maintain history in any application. It also provide history for many_to_many fields, with ready admin page.
With django 3 supports.
Quick start
Install django-model-audit:
pip install django-audittrail
Add “audit_trail” to your INSTALLED_APPS:
INSTALLED_APPS = [ ... 'audit_trail', ]Add Middlewre:
MIDDLEWARE = [ ... 'audit_trail.middleware.AuditMiddleware' ]Run Migrate:
python manage.py migrate
Add an AuditTrail and manager to model you want to create history:
from audit_trail.history import AuditTrail, AuditManager class MyModel(models.Model): ... history = AuditTrail() objects = AuditManager.as_manager() class Meta: display_format = '{model_name.field_name}'To add admin screen for audit simply inherit AuditTrailAdmin in your model admin:
from audit_trail.admin import AuditTrailAdmin class MyModelAdmin(AuditTrailAdmin): ...Visit django model admin screen to get the history of particular model(Click on History button in that screen).
To get audit trail of many_to_many fields just send signal from your AppConfig class’ ready method:
from audit_trail.signals import audit_m2m_ready class MyappConfig(AppConfig): ... def ready(self): audit_m2m.ready.send(sender=self.__class__) ...To get audit trail logs in your django app import and call function get_audit_trail() like this:
from audit_trail.admin import get_audit_trail get_audit_trail(model_name, object_id)
Metadata
Release files for django-audittrail 0.2.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| django-audittrail-0.2.1.tar.gz | 30.9 kB | Without provenance | Details for django-audittrail-0.2.1.tar.gz |
Release files / django-audittrail-0.2.1.tar.gz
| Download URL | django-audittrail-0.2.1.tar.gz |
|---|---|
| Size | 30.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9ecdb0541ad246b59f6cf427f3133fd125233d9ae3714a17240ecb880d0de887
|
|
BLAKE2b-256 checksum How to use checksums |
ca9db83d145b4affab519afa359294654a37429f7c236756ee71870d702029bb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.8.2
|
Security for django-audittrail 0.2.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.