I want to know if I can use the logs that are displayed on Django Admin in a custom React Js Admin Panel. I have a requirement which is to show all recent changes done by any user. Django admin already has that Recent Actions widget. How can I use that data and serialize it in some API/View
I tried using django-simple-history but it shows specific history for a specific object. I want a complete generic log list
That data in the admin is based on the LogEntry
model from django.contrib.admin
: django docs
The 'recent actions' list in the admin is generated when the template for the index page of the admin calls the get_admin_log
template tag. That tag creates a template node that sets a context variable to the recent LogEntry objects of the user. See here. The index template then renders the LogEntry objects from that variable.
So basically, you just need to add a view that queries the LogEntry model for the most recent actions of the current user and then returns the serialized queryset.