Django app that records model state on every create, update, and delete. You can browse history and revert changes from the admin or in code.
Overview
django-simple-history stores a snapshot of Django model state whenever records are created, updated, or deleted. The goal is a full audit-style trail tied to your existing models, with tooling to inspect past versions and roll back from the admin interface when permitted.
Documentation covers registering models for tracking, querying history on instances or model classes, walking previous and next historical records, and reverting to an earlier state. Features include historic foreign keys and one-to-one fields, as-of queries, utilities to diff versions, and options to save without creating a history row.
Admin integration adds history list views with customization for columns, page size, and templates, plus controls to disable revert or enforce permissions on historical models. You can tailor history tables and managers, exclude fields, track many-to-many changes, attribute edits to users, and place history tables in a separate app or database when needed.
Maintenance commands such as clean-duplicate-history and clean-old-history help trim stored rows. The project documents compatibility with supported Django and Python pairings and lists many configuration edge cases, including bulk create or update, custom users, and multi-table inheritance.
Key features
- History on create, update, delete
- Admin history and revert
- Instance and model history queries
- Revert to prior versions
- HistoricForeignKey support
- User tracking on changes
- Many-to-many history tracking
- Custom history managers and tables
Use cases
- Audit who changed Django records
- Undo bad edits from admin
- Compliance-friendly change logs
- Compare versions of model rows
- Track M2M membership over time