Logging activity on Django’s admin – Django

I had to do something similar and I used something like this:

from django.contrib.admin.models import LogEntry

logs = LogEntry.objects.all() #or you can filter, etc.
for l in logs:
    #perform action

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!

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)