mirror of
https://github.com/jazzband/django-auditlog.git
synced 2026-03-16 22:20:26 +00:00
Simplify is_authenticated check
This attribute is defined on request.user from Django 1.10 or a comparably ancient version.
This commit is contained in:
parent
6b60d04e44
commit
121fe99cf5
1 changed files with 1 additions and 3 deletions
|
|
@ -20,9 +20,7 @@ class AuditlogMiddleware:
|
|||
else:
|
||||
remote_addr = request.META.get("REMOTE_ADDR")
|
||||
|
||||
if hasattr(request, "user") and getattr(
|
||||
request.user, "is_authenticated", False
|
||||
):
|
||||
if hasattr(request, "user") and request.user.is_authenticated:
|
||||
context = set_actor(actor=request.user, remote_addr=remote_addr)
|
||||
else:
|
||||
context = contextlib.nullcontext()
|
||||
|
|
|
|||
Loading…
Reference in a new issue