django-easy-audit
django-easy-audit copied to clipboard
Add custom model for CRUD events
I want to add extra fields to the CRUD event model. My use case is that my application has a feature to invite users who can work on the account owner's data. To do that, I have a middleware that updates request.user
with the account owner, in case an invited user is logged in. Also, set request._shared_user
to the user who is logged in and acting.
In this case, all events are being logged with the owner user as user instance and, who has performed the event is not being logged.
Could I extend the base CRUD Event table and add a field like shared_user = models.ForeignKey(User)
and then update the crud()
method to add shared_user = request._shared.user