aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrea Lepori <alepori@student.ethz.ch>2021-12-26 21:10:33 +0100
committerAndrea Lepori <alepori@student.ethz.ch>2021-12-26 21:11:12 +0100
commitc85b20cfc2d6296df58507af452e03359ae6318c (patch)
tree8a8787e27896a538aac5e2ff4800af7432288116
parentadd account data validation (diff)
downloadscout-subs-c85b20cfc2d6296df58507af452e03359ae6318c.tar.gz
scout-subs-c85b20cfc2d6296df58507af452e03359ae6318c.zip
fix wrong filter on doctypes on server index
-rw-r--r--server/views.py8
-rw-r--r--version.txt2
2 files changed, 7 insertions, 3 deletions
diff --git a/server/views.py b/server/views.py
index 8c1732a..f50ae61 100644
--- a/server/views.py
+++ b/server/views.py
@@ -53,13 +53,17 @@ def index(request):
if request.user.is_staff:
groups = request.user.groups.all()
+ q_obj = Q(group__in=groups)
+
doc_types = DocumentType.objects.filter(
- Q(group_private=False) | Q(group=groups[0]) & Q(enabled=True)).order_by("-id")
+ (Q(group_private=False) | q_obj) & Q(enabled=True)).order_by("-id")
else:
groups = request.user.groups.all()[1:]
+ q_obj = Q(group__in=groups)
+
doc_types = DocumentType.objects.filter(
- Q(group_private=False) & Q(enabled=True)).order_by("-id")
+ Q(group_private=False) & Q(enabled=True) & q_obj).order_by("-id")
# check for settings
group_check = []
diff --git a/version.txt b/version.txt
index b5aac86..571dffe 100644
--- a/version.txt
+++ b/version.txt
@@ -1,2 +1,2 @@
version=0.4
-rev=4
+rev=5