django-auditlog
django-auditlog copied to clipboard
Is there a way to change the 'User' when logging?
Currently, due to my app being an API it logs that the 'system' made the change. In each of the API calls, I'm passing a Token for authentification which corresponds to a certain user. Is there a way to change out which table or resource django-auditlog looks for when someone makes a change?
Have you found a way? I have the same problem as you。
@lijiapengsa no luck currently, I'll try to dive into the source code when I get the time to actually try to work something out
@MislavPeric I use a different method for logging users, using a mixin class to append the username to the additional_data field.
The result looks like the following:
Have you set the actors middleware?
Found a good solution in this comment.
I changed the is_authenticated(request.user)
line to request.user.is_authenticated
(since auditlog.compat
is no longer included in the package, and the function was only used for backwards compatibility). Also updated django.utils.functional.curry
to functools.partial
.