Reputation: 11543
Someone in my team deleted an important object. I need to know who did it, he obviously had access to the admin. Is there a way I can print to the terminal (or anywhere) all the admin actions of the last 3 hours? I'm sure django keeps a history, I just don't know where to find it.
Upvotes: 0
Views: 643
Reputation: 11543
This solved it:
>>> from django.contrib.admin.models import LogEntry
>>> x = LogEntry.objects.all().order_by("-id")[:200]
>>> for y in x:
... print("%s - %s" % (y.action_time, y.change_message))
Upvotes: 1