{"categories":[{"label":"Database","url":"https://skillfed.io/packages/category/database/2"}],"enrichment":{"capability":"Tracks all changes to Django models using PostgreSQL triggers, storing a complete audit trail without modifying application code.","skillfed_tags":["audit-trail","postgres-triggers","compliance"],"use_cases":["Audit compliance: maintain a tamper-resistant record of all model changes for regulatory requirements.","Soft deletes and recovery: revert models to previous versions or implement logical deletion with full history.","User activity tracking: attach context like user ID to each change for accountability and debugging.","Data debugging: trace the sequence of field changes to diagnose unexpected model states.","Bulk operation auditing: capture changes from bulk operations or raw SQL that ORM hooks would miss."],"what_it_does":"django-pghistory is a Django package that automatically records every change to your models by installing PostgreSQL triggers on the underlying tables. Instead of instrumenting your application code, it captures inserts, updates, and bulk operations\u2014even raw SQL changes\u2014at the database level and stores them in dynamically-created event models that mirror your original model's fields. You decorate a model with `@pghistory.track()`, run migrations, and the system handles the rest: every modification is logged with metadata fields like `pgh_obj` (the tracked object ID) and timestamps.\n\nThe package includes admin integration and middleware for attaching application context (such as the logged-in user) to events without extra database queries. It supports selective field tracking, conditional event storage based on field transitions, and aggregation across multiple event models. Since it relies on PostgreSQL triggers rather than application-level hooks, it captures changes regardless of how they reach the database\u2014ORM saves, bulk updates, or direct SQL all get tracked.","worth_installing":"Yes. The package is actively maintained, has low install friction, carries a permissive license, and solves a real problem\u2014reliable audit trails without application code changes. It's well-suited for Django projects using PostgreSQL where compliance, debugging, or recovery capabilities matter. No known security vulnerabilities. Primary constraint is PostgreSQL dependency; it will not work with other databases."},"id":"django-pghistory","links":{"html":"https://skillfed.io/packages/django-pghistory","md":"https://skillfed.io/packages/django-pghistory.md","pypi":"https://pypi.org/project/django-pghistory/"},"maintenance":{"status":"active"},"meta":{"latest_release":"2026-02-17","license_spdx":null,"license_treatment":"permissive","name":"django-pghistory","python_support":"supports_current","summary":"History tracking for Django and Postgres"},"popularity":{"monthly_downloads":783657,"position":5074,"tier":"top_15000"},"security":{"n_vulnerabilities":0},"version":"3.9.2"}
