Skip to content
Advertisement

How to generate the users activity report in django?

I am building the system in Django rest framework, in which the admin level user will govern the local users , I need to keep track of lower level users activity, example: s user activity such as adding some post or deleting and so on other lots of activities. Is there any package or any good implementation on how it can be achieved ?

Advertisement

Answer

You can access the Track Log of Admin activities like :-

from django.contrib.admin.models import LogEntry

logs = LogEntry.objects.all() # You can also filter
for l in logs:
    #access or perform actions

Edit :-

To access the time of activity or action. You can access it by action_time:-

logs = LogEntry.objects.all() # You can also filter
    for l in logs:
        actionTime = l.action_time # Changed Here

It will show the time of action made by user

User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement