mirror of
https://github.com/jazzband/django-auditlog.git
synced 2026-03-16 22:20:26 +00:00
Support search by custom USERNAME_FIELD (#432)
This commit is contained in:
parent
a56d0e6f78
commit
0f57525058
2 changed files with 3 additions and 1 deletions
|
|
@ -10,6 +10,7 @@
|
|||
- fix: Display `created` timestamp in server timezone ([#404](https://github.com/jazzband/django-auditlog/pull/404))
|
||||
- fix: Handle port in `remote_addr` ([#417](https://github.com/jazzband/django-auditlog/pull/417))
|
||||
- fix: Handle the error with AttributeError: 'OneToOneRel' error occur during a `PolymorphicModel` has relation with other models ([#429](https://github.com/jazzband/django-auditlog/pull/429))
|
||||
- fix: Support search by custom USERNAME_FIELD ([#432](https://github.com/jazzband/django-auditlog/pull/432))
|
||||
|
||||
## 2.1.1 (2022-07-27)
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
from django.contrib import admin
|
||||
from django.contrib.auth import get_user_model
|
||||
|
||||
from auditlog.filters import ResourceTypeFilter
|
||||
from auditlog.mixins import LogEntryAdminMixin
|
||||
|
|
@ -14,7 +15,7 @@ class LogEntryAdmin(admin.ModelAdmin, LogEntryAdminMixin):
|
|||
"changes",
|
||||
"actor__first_name",
|
||||
"actor__last_name",
|
||||
"actor__username",
|
||||
f"actor__{get_user_model().USERNAME_FIELD}",
|
||||
]
|
||||
list_filter = ["action", ResourceTypeFilter]
|
||||
readonly_fields = ["created", "resource_url", "action", "user_url", "msg"]
|
||||
|
|
|
|||
Loading…
Reference in a new issue