From c1e45c32a191311452f80a7d874ea00144fff98e Mon Sep 17 00:00:00 2001 From: Andrea Lepori Date: Tue, 4 Oct 2022 19:31:16 +0200 Subject: complete custom group support for superuser --- server/views.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'server') diff --git a/server/views.py b/server/views.py index 9babb92..8b1d4fd 100644 --- a/server/views.py +++ b/server/views.py @@ -119,9 +119,8 @@ def uapprove(request): data = [] if request.method == "POST": # get group name and obj - parent_group = request.user.groups.values_list('name', flat=True)[ - 0] - group = Group.objects.get(name=parent_group) + group = getGroups(request.user)[0] + parent_group = group.name # get permission object permission = Permission.objects.get(codename='approved') @@ -423,7 +422,7 @@ def ulist(request): # list users with their documents permission = Permission.objects.get(codename="approved") - usercodes = UserCode.objects.filter(Q(user__user_permissions=permission) | Q(user__is_staff=True)).filter(user__groups__contains=group).select_related("user", "medic").order_by("user__last_name") + usercodes = UserCode.objects.filter(Q(user__user_permissions=permission) | Q(user__is_staff=True)).filter(user__groups__name__contains=group.name).select_related("user", "medic").order_by("user__last_name") vac_file = ["/server/media/", "/vac_certificate/usercode"] health_file = ["/server/media/", "/health_care_certificate/usercode"] -- cgit v1.2.1