Django-pghistory

Latest version: v3.5.1

Safety actively analyzes 701762 Python packages for vulnerabilities to keep your Python projects secure.

Scan your dependencies

Page 3 of 8

3.0.0

Api-Break

- V3 release with new event trackers [Wesley Kendall, 8849fc6]

Version three of `django-pghistory` has some of the following breaking changes:

- Removal of code deprecated in version 2.5 related to configuring event models
- Consolidation of the event trackers. `pghistory.Snapshot` and all custom
event trackers such as `pghistory.BeforeDelete` and `pghistory.AfterInsertOrUpdate`
were consolidated into three core event trackers: `pghistory.InsertEvent`,
`pghistory.UpdateEvent`, and `pghistory.DeleteEvent`.
- There are new default `pgh_label` values in the new event trackers
- The `pghistory.models.Events` proxy aggregate model has some minor breaking
functionality.

Along with this, default arguments to `pghistory.track` were changed and
a setting was introduced to override the global default history trackers.

There's an entire section called "Upgrading" in the docs
at django-pghistory.readthedocs.io that goes over the breaking changes in
more detail, along with how to preserve the default functionality from
version two.

Feature

- Support append-only event models [Wesley Kendall, 9002d35]

Supply `append_only=True` to `pghistory.track` or `pghistory.create_event_model` to
create event models that protect updates and deletes.

Set `settings.PGHISTORY_APPEND_ONLY = True` to make this the default for all event
models.

2.9.0

Feature

- Add Python 3.12 support and use Mkdocs for documentation [Wesley Kendall, 4464ef3]

Python 3.12 and Postgres 16 are supported now, along with having revamped docs using Mkdocs and the Material theme.

Python 3.7 support was dropped.

2.8.0

Feature

- Added Python 3.11, Django 4.2, and Psycopg 3 support [Wesley Kendall, 647cdad]

Adds Python 3.11, Django 4.2, and Psycopg 3 support along with tests for multiple Postgres versions.
Drops support for Django 2.2.

2.7.0

Feature

- Refactory ``Snapshot`` class and add ``Changed`` condition for better extensibility. [Kevin Ramirez, 0be9242]

Users can more easily inherit ``pghistory.Snapshot`` and use the ``pghistory.Changed``
condition for conditional snapshots.
- Add ``BeforeUpdateOrDelete`` tracker [Kevin Ramirez, af01e87]

Adds a barebones ``BeforeUpdateOrDelete`` tracker for snapshotting OLD rows during an update or delete.

Trivial

- Fix auto-doc formatting [madtools, de3ddf4]

2.6.0

Bug

- Fix documentation example for tracking events. [Zac Miller, acaaadf]
- Fix bug when tracking context data with percent sign. [Adam Johnson, a5380fa]

All context data is properly escaped, fixing an error that happened when
using "%" in any context data. psycopg now escapes all context data,
ensuring there is no SQL injection vector in the future.

Trivial

- Replace usage of ``SET LOCAL`` with ``SELECT set_config`` for better pg stat reporting. [Pierre Ducroquet, ebe2d19]
- Fix ``make lint`` command with new .gitignore changes [Kevin Ramirez, ceafe0a]
- Fix ``PGHISTORY_OBJ_FIELD`` settings name in the docs. [Johan Van de Wauw, 2bfb23d]
- Updated with latest django template, fixing git-tidy deployment issues [Wesley Kendall, 1a6df96]

2.5.1

Not secure
Trivial

- Updated with latest Django template [Wesley Kendall, de8a535]
- A safer way of determining fields when creating the snapshot triggers [Wesley Kendall, 7b368c3]

Page 3 of 8

© 2025 Safety CLI Cybersecurity Inc. All Rights Reserved.