- Don't fail when attempting to use the
who
command to get the current user if thewho
command is not available e.g. on Windows.
- Use Django's
timezone.now
instead ofdatetime.now
to ensure the correct timezone is used when creating audit events.
- Resolve a recursion issue with multiple deferred audit fields.
- Resolve bug with incorrect previous values when updating an audited field in the save method of the object.
- All audited methods use SQL transactions to ensure changes to audited models are only written to the database if the audit event is successfully written
- Optimize
QuerySet.delete
to only fetch audited values from database - Add support for auditing
QuerySet.bulk_create
method
- Add support for auditing
QuerySet.update
method
- Use batching by default for all bootstrap operations
- Add a
--batch-size
option to the bootstrap management command
- Add management command for bootstrapping
- Add new "top up" bootstrap action
- Fix migration constraint condition ordering which caused Django<4.0 to think a new migration was needed.
- Add ability to bootstrap audit events for existing model records.
- Add Django compatibility tests.
- Add auditing support for "special"
QuerySet
write methods
-
Remove
FieldChange
model in favor of storing the full delta on theAuditEvent
model. -
Add ability to define custom class paths for audited models.
-
IMPORTANT NOTE: if you used version 0.2 to generate audit records, this upgrade is destructive.
Version 0.2 was never used for production by the author, and migrating data from that version to 1.0.0 is not implemented. If you wish to retain existing (version 0.2) audit records, you will need to preserve those records and migrate them yourself.
Steps to upgrade if you do not wish to retain any existing data are as follows:
python manage.py migrate field_audit zero pip install -U django-field-audit python manage.py migrate field_audit
Steps to upgrade while retaining your existing data are as follows:
-
Run the following commands against your database to preserve the existing
field_audit_auditevent
table:ALTER TABLE field_audit_auditevent RENAME TO field_audit_v02_auditevent; ALTER SEQUENCE field_audit_auditevent_id_seq RENAME TO field_audit_v02_auditevent_id_seq; ALTER INDEX field_audit_auditevent_pkey RENAME TO field_audit_v02_auditevent_pkey; ALTER INDEX field_audit_auditevent_event_date_129a0da2 RENAME TO field_audit_v02_auditevent_event_date_129a0da2; ALTER INDEX field_audit_auditevent_object_class_path_034c1566 RENAME TO field_audit_v02_auditevent_object_class_path_034c1566; ALTER INDEX field_audit_auditevent_object_class_path_034c1566_like RENAME TO field_audit_v02_auditevent_object_class_path_034c1566_like;
-
Fake the zero migration for the
field_audit
app:python manage.py migrate field_audit zero --fake
-
Upgrade and run migrations:
pip install -U django-field-audit python manage.py migrate field_audit
-
Migrate your data from the old tables (
field_audit_v02_auditevent
andfield_audit_fieldchange
) into the newfield_audit.models.AuditEvent
model.
-
- Initial implementation.
- There is no version
0.1
.