Reputation: 44
I followed this tutorial : https://docs.djangoproject.com/en/2.2/ref/contrib/admin/actions/
And i cant't see log about this action in to History.(But changed,.. default actions of django admin can show blog on there)
How can i add log to History like 'User_1 Make published' ? Thank you so much.
Upvotes: 0
Views: 901
Reputation: 3890
You can create a simple log entry section in the admin page like so:
admin.py:
from django.contrib import admin
class LogEntryAdmin(admin.ModelAdmin):
list_display = ('id', 'get_string', 'action_time', 'object_id')
actions = None
def get_string(self, obj):
return str(obj)
search_fields = ['=user__username', ]
fieldsets = [
(None, {'fields':()}),
]
def __init__(self, *args, **kwargs):
super(LogEntryAdmin, self).__init__(*args, **kwargs)
self.list_display_links = None
admin.site.register(admin.models.LogEntry, LogEntryAdmin)
It can show a page of every changes that made on the data form the admin pages form which user
Upvotes: 2