aboutsummaryrefslogtreecommitdiffstats
path: root/server/views.py
diff options
context:
space:
mode:
authorAndrea Lepori <alepori@student.ethz.ch>2022-01-02 18:35:07 +0100
committerAndrea Lepori <alepori@student.ethz.ch>2022-01-02 18:35:10 +0100
commit24c6f8e58953d19f37079dedd16a3910a1e5e556 (patch)
treeba1843604aeeb2f6d8a9aa908ed5a146d64dfe35 /server/views.py
parentpof of oauth2 (diff)
parentremove unused variables/imports (diff)
downloadscout-subs-24c6f8e58953d19f37079dedd16a3910a1e5e556.tar.gz
scout-subs-24c6f8e58953d19f37079dedd16a3910a1e5e556.zip
Merge branch 'master' into dev
Diffstat (limited to '')
-rw-r--r--server/views.py11
1 files changed, 6 insertions, 5 deletions
diff --git a/server/views.py b/server/views.py
index 8c1732a..78be0b2 100644
--- a/server/views.py
+++ b/server/views.py
@@ -11,7 +11,6 @@ from django.template.loader import get_template
from django.conf import settings
from django.contrib.admin.views.decorators import staff_member_required
from django.contrib.auth.decorators import user_passes_test
-from django.contrib.contenttypes.models import ContentType
from django.contrib.sessions.backends.db import SessionStore
import csv
@@ -53,13 +52,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 = []
@@ -326,8 +329,6 @@ def doctype(request):
1:]
if request.method == "POST":
- selected = []
-
# check if request to edit
if request.POST["action"][0] == 'e':
document_type = DocumentType.objects.get(id=request.POST["action"][1:])