Talk is cheap, show me the code – Linus Torvalds
from django.contrib import admin
from django.contrib.admin.models import LogEntry
class ReadOnlyAdminMixin:
def has_add_permission(self, request):
return False
def has_change_permission(self, request, obj=None):
return False
def has_delete_permission(self, request, obj=None):
return False
@admin.register(LogEntry)
class LogEntryAdmin(ReadOnlyAdminMixin, admin.ModelAdmin):
list_display = [
"user",
"action_flag",
"content_type",
"object_id",
"object_repr",
"change_message",
]