[Django]-Use Django Model class inheritance to create an audit log for a table

3👍

Why not use something made such as the Audit Trail app? I can’t really see how inheritance really fits into the abstraction needed for logging. Audit Trail uses a simple declaration in the class which packages all of the activities.

0👍

Two possible pre-coded solutions are https://github.com/etianen/django-reversion and http://code.djangoproject.com/wiki/AuditTrail . More options are at https://www.djangopackages.com/grids/g/model-audit/

As you note, foreign key references are tricky, especially for Many-To-Many models. You have to decide if the old models are a constraint on new tables, else break those relationships which complicates “undo” considerably.

👤Bryce

Leave a comment