From 4c29d855d288ea091f27031083fe1afc5f40a859 Mon Sep 17 00:00:00 2001 From: Yohann D'ANELLO Date: Sat, 25 Jul 2020 20:07:45 +0200 Subject: [PATCH] Fix RolePermissions merge --- apps/permission/backends.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/apps/permission/backends.py b/apps/permission/backends.py index 9dc69d3d..99f1b2da 100644 --- a/apps/permission/backends.py +++ b/apps/permission/backends.py @@ -37,17 +37,17 @@ class PermissionBackend(ModelBackend): return Permission.objects.none() qs = Permission.objects.annotate( - club=F("role__role__membership__club"), - membership=F("role__role__membership"), + club=F("role__membership__club"), + membership=F("role__membership"), ).filter( ( Q( - role__role__membership__date_start__lte=timezone.now().today(), - role__role__membership__date_end__gte=timezone.now().today(), + role__membership__date_start__lte=timezone.now().today(), + role__membership__date_end__gte=timezone.now().today(), ) | Q(permanent=True) ) - & Q(role__role__membership__user=user) + & Q(role__membership__user=user) & Q(type=t) & Q(mask__rank__lte=get_current_session().get("permission_mask", 0)) )