jazzband / django-auditlog

A Django app that keeps a log of changes made to an object.
MIT License
1.12k stars 409 forks source link

Is it possible to add auditlog based on ManyToOneRelations? #640

Open jforsman opened 4 months ago

jforsman commented 4 months ago

Simple example:

class ModelA(models.Model): id = ...

class ModelB(models.Model): modela = models.ForeignKey(ModelA, related="modelbs")

I want to have auditlog change entry on a ModelA instance when ModelB is created, deleted, changed etc. with the given ModelA instance. Is this possible somehow? Did not find any ManyToOneRelation parameter (like there is one for m2m fields tracking). Did not find any test cases for this scenario so I would assume that this is not supported?