From ab7a8cb120fe905562281b331a08e87abeff0fbe Mon Sep 17 00:00:00 2001 From: Andrew Godwin Date: Fri, 25 Nov 2022 18:37:09 -0700 Subject: Don't error admin decorator on anonymous --- users/decorators.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/users/decorators.py b/users/decorators.py index 5226460..26778ec 100644 --- a/users/decorators.py +++ b/users/decorators.py @@ -30,4 +30,4 @@ def identity_required(function): def admin_required(function): - return user_passes_test(lambda user: user.admin)(function) + return user_passes_test(lambda user: user.is_authenticated and user.admin)(function) -- cgit v1.2.3