Last active
February 4, 2020 13:27
-
-
Save malikalbeik/0c7f8f42e1d6fa2823c85e59920aca8e to your computer and use it in GitHub Desktop.
Register Django's LogEntry model in Django Admin.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.contrib.admin.models import LogEntry | |
@admin.register(LogEntry) | |
class LogEntryAdmin(admin.ModelAdmin): | |
# to have a date-based drilldown navigation in the admin page | |
date_hierarchy = 'action_time' | |
# to filter the resultes by users, content types and action flags | |
list_filter = [ | |
'user', | |
'content_type', | |
'action_flag' | |
] | |
# when searching the user will be able to search in both object_repr and change_message | |
search_fields = [ | |
'object_repr', | |
'change_message' | |
] | |
list_display = [ | |
'action_time', | |
'user', | |
'content_type', | |
'action_flag', | |
] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment