diff options
author | Andrea Lepori <alepori@student.ethz.ch> | 2022-10-04 19:31:16 +0200 |
---|---|---|
committer | Andrea Lepori <alepori@student.ethz.ch> | 2022-10-04 19:31:16 +0200 |
commit | c1e45c32a191311452f80a7d874ea00144fff98e (patch) | |
tree | 4aa2c73555e399143cf28e1eabefe12912d30f99 /server/views.py | |
parent | initial modification to support superuser account (diff) | |
download | scout-subs-c1e45c32a191311452f80a7d874ea00144fff98e.tar.gz scout-subs-c1e45c32a191311452f80a7d874ea00144fff98e.zip |
complete custom group support for superuser
Diffstat (limited to 'server/views.py')
-rw-r--r-- | server/views.py | 7 |
1 files changed, 3 insertions, 4 deletions
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"]
|