From c85b20cfc2d6296df58507af452e03359ae6318c Mon Sep 17 00:00:00 2001 From: Andrea Lepori Date: Sun, 26 Dec 2021 21:10:33 +0100 Subject: fix wrong filter on doctypes on server index --- server/views.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'server') 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 = [] -- cgit v1.2.1 From 536ec9fbca0a3ebc082dd98bf575bbef2949e94e Mon Sep 17 00:00:00 2001 From: Andrea Lepori Date: Sun, 26 Dec 2021 21:14:34 +0100 Subject: remove unused variables/imports --- server/views.py | 3 --- 1 file changed, 3 deletions(-) (limited to 'server') diff --git a/server/views.py b/server/views.py index f50ae61..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 @@ -330,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:]) -- cgit v1.2.1