Fix decorator

This commit is contained in:
Ludovic Stephan 2021-02-24 00:28:17 +01:00
parent 93d283fecb
commit a947b9d3f2

View file

@ -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")