Skip to main content

django-audit-snap

Tracking changes to django models.

  • Model fields for keeping track of the user and session that created and modified a model instance.

  • Abstract model class with fields created_by and modified_by fields.

  • A model manager class that can automatically track changes made to a model in the database.

  • Support for modern Django versions and custom User classes.

  • Python 3.8+ support

Tracking full model history on M2M relations is not supported.

Quickstart Guide

Install it with pip from PyPi:

pip install django-audit-snap

Add audit_log.middleware.UserLoggingMiddleware to your MIDDLEWARE_CLASSES:

MIDDLEWARE_CLASSES = (
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
'audit_log.middleware.UserLoggingMiddleware',
)

To just track who created or edited a model instance just make it inherit from AuthStampedModel:

from audit_log.models import AuthStampedModel

class WarehouseEntry(AuthStampedModel):
    product = models.ForeignKey(Product)
    quantity = models.DecimalField(max_digits = 10, decimal_places = 2)

This will add 4 fields to the WarehouseEntry model:

  • created_by - A foreign key to the user that created the model instance.

  • created_with_session_key - Stores the session key with which the model instance was first created.

  • modified_by - A foreign key to the user that last saved a model instance.

  • modified_with_session_key - Stores the session key with which the model instance was last saved.

If you want to track full model change history you need to attach an AuditLog manager to the model:

from django.db import models
from audit_log.models.fields import LastUserField
from audit_log.models.managers import AuditLog


class ProductCategory(models.Model):
    name = models.CharField(max_length=150, primary_key = True)
    description = models.TextField()

    audit_log = AuditLog()

class Product(models.Model):
    name = models.CharField(max_length = 150)
    description = models.TextField()
    price = models.DecimalField(max_digits = 10, decimal_places = 2)
    category = models.ForeignKey(ProductCategory)

    audit_log = AuditLog()

You can then query the audit log:

In [2]: Product.audit_log.all()
Out[2]: [<ProductAuditLogEntry: Product: My widget changed at 2011-02-25 06:04:29.292363>,
        <ProductAuditLogEntry: Product: My widget changed at 2011-02-25 06:04:24.898991>,
        <ProductAuditLogEntry: Product: My Gadget super changed at 2011-02-25 06:04:15.448934>,
        <ProductAuditLogEntry: Product: My Gadget changed at 2011-02-25 06:04:06.566589>,
        <ProductAuditLogEntry: Product: My Gadget created at 2011-02-25 06:03:57.751222>,
        <ProductAuditLogEntry: Product: My widget created at 2011-02-25 06:03:42.027220>]

Note: This is a maintained fork of the original django-audit-log by Vasil Vangelovski (Atomidata), updated for modern Django and Python versions.

Metadata

Release files for django-audit-snap 0.9.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for django-audit-snap 0.9.1
File Size Uploaded Provenance
django_audit_snap-0.9.1.tar.gz 15.6 kB With provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for django-audit-snap 0.9.1
File Interpreter ABI Platform
django_audit_snap-0.9.1-py3-none-any.whl Python 3 none any Details

Total release size: 35.3 kB

Release files / django_audit_snap-0.9.1.tar.gz

Download URL django_audit_snap-0.9.1.tar.gz
Size 15.6 kB
Tags Source
SHA-256 checksum
How to use checksums
385166339d84e3111caa9fa0ed52b86caaf715883f24188404b9bc9ad01e23d9
BLAKE2b-256 checksum
How to use checksums
9004b0db90541ee2752d7ff74bbfc11b47f8364b09d8e472781d1e323112785a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 13, 2026.

Transparency log

Release files / django_audit_snap-0.9.1-py3-none-any.whl

Download URL django_audit_snap-0.9.1-py3-none-any.whl
Size 19.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0d220d1cfe6398db5a3d54f4bb00b8325c6c2f5f99c9c6b14c14b6f4cd91f1ef
BLAKE2b-256 checksum
How to use checksums
68313aad29d8c4fcb3e51438705eda43bc22509fbb964536ee86ecb3f9d54f06
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 13, 2026.

Transparency log

Security for django-audit-snap 0.9.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.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for django_audit_snap-0.9.1.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 13, 2026.

Transparency log

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.

Release history Release notifications | RSS feed

This release

0.9.1 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page