I need to track/log activity on the Django admin.
I know there are messages stored by admin somewhere, but I don't know how to access them in order to use them as a simple log.
I'm trying to track the following:
User performing the action
Action committed
Datetime of action
Thanks guys.
I had to do something similar and I used something like this:
You can see all of the attributes for LogEntry, but I think the ones you are looking for are l.user, l.action_time and l.obj_repr (the name of the obj) and l.action_flag ({ 1:'Add',2:'Change',3:'Delete'}). Hope that helps!
If you don't mind installing an extra dependency, I can recommend django-logentry-admin, worked like a charm for me.
Log is in django_admin_log table in database used by django.
Take a look at the LogEntry class which stores the log for the actions inside the admin.
You could use it like this to insert custom entries in the logs: