mirror of
https://github.com/jazzband/django-auditlog.git
synced 2026-03-16 22:20:26 +00:00
Auditlog admin use list_select_related (#382)
* Use list_select_related * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
This commit is contained in:
parent
957680e239
commit
dd89c3cefb
1 changed files with 1 additions and 4 deletions
|
|
@ -6,6 +6,7 @@ from auditlog.models import LogEntry
|
|||
|
||||
|
||||
class LogEntryAdmin(admin.ModelAdmin, LogEntryAdminMixin):
|
||||
list_select_related = ["content_type", "actor"]
|
||||
list_display = ["created", "resource_url", "action", "msg_short", "user_url"]
|
||||
search_fields = [
|
||||
"timestamp",
|
||||
|
|
@ -26,9 +27,5 @@ class LogEntryAdmin(admin.ModelAdmin, LogEntryAdminMixin):
|
|||
# As audit admin doesn't allow log creation from admin
|
||||
return False
|
||||
|
||||
def get_queryset(self, request):
|
||||
queryset = super().get_queryset(request).select_related("content_type", "actor")
|
||||
return queryset
|
||||
|
||||
|
||||
admin.site.register(LogEntry, LogEntryAdmin)
|
||||
|
|
|
|||
Loading…
Reference in a new issue