From a947b9d3f28cc5c01419c0a6c739e52e6756221c Mon Sep 17 00:00:00 2001 From: Ludovic Stephan Date: Wed, 24 Feb 2021 00:28:17 +0100 Subject: [PATCH] Fix decorator --- kfet/decorators.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/kfet/decorators.py b/kfet/decorators.py index a01e867d..0db0c2e1 100644 --- a/kfet/decorators.py +++ b/kfet/decorators.py @@ -2,7 +2,11 @@ from django.contrib.auth.decorators import user_passes_test def kfet_is_team(user): - if hasattr(user.profile, "account_kfet") and user.profile.account_kfet.is_frozen: + if ( + hasattr(user, "profile") + and hasattr(user.profile, "account_kfet") + and user.profile.account_kfet.is_frozen + ): return False return user.has_perm("kfet.is_team")