aboutsummaryrefslogtreecommitdiffstats
path: root/server/views.py
diff options
context:
space:
mode:
authorAndrea Lepori <alepori@student.ethz.ch>2022-03-23 19:24:09 +0100
committerAndrea Lepori <alepori@student.ethz.ch>2022-03-23 19:24:21 +0100
commit7dfc0383561cb9f13282e7779b919f5b17859f86 (patch)
treed2f3ed554dfd259025845c7f93e02254e1a8beb3 /server/views.py
parentinitial support of user switcher (diff)
parentin case of error redirect to home page (diff)
downloadscout-subs-7dfc0383561cb9f13282e7779b919f5b17859f86.tar.gz
scout-subs-7dfc0383561cb9f13282e7779b919f5b17859f86.zip
Merge branch 'master' into dev
Diffstat (limited to '')
-rw-r--r--server/views.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/server/views.py b/server/views.py
index 0e032f0..c91db1e 100644
--- a/server/views.py
+++ b/server/views.py
@@ -1472,11 +1472,13 @@ def data_request(request):
if "request" not in request.POST.keys():
context["error"] = "Selezionare una richesta"
elif request.POST["request"] == "email_all":
- users_email = User.objects.filter(groups__name=parent_group).values_list("email", flat=True)
+ perm = Permission.objects.get(codename="approved")
+ users_email = User.objects.filter(groups__name=parent_group, user_permissions=perm).values_list("email", flat=True)
data = ", ".join(users_email)
context["data"] = data
elif request.POST["request"] == "email_non_staff":
- users_email = User.objects.filter(groups__name=parent_group).exclude(groups__name="capi").values_list("email", flat=True)
+ perm = Permission.objects.get(codename="approved")
+ users_email = User.objects.filter(groups__name=parent_group, user_permission=perm).exclude(groups__name="capi").values_list("email", flat=True)
data = ", ".join(users_email)
context["data"] = data
elif request.POST["request"] == "data_user":