Fix n+1 query problem (#381)

This commit is contained in:
Youngkwang Yang 2022-05-31 20:05:43 +09:00 committed by GitHub
parent d9b0d76f3a
commit 957680e239
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 0 deletions

View file

@ -10,6 +10,7 @@
- Fix inconsistent changes with JSONField ([#355](https://github.com/jazzband/django-auditlog/pull/355))
- Disable `add` button in admin ui ([#378](https://github.com/jazzband/django-auditlog/pull/378))
- Fix n+1 query problem([#381](https://github.com/jazzband/django-auditlog/pull/381))
## 2.0.0 (2022-05-09)

View file

@ -26,5 +26,9 @@ 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)