diff options
author | Andrea Lepori <alepori@student.ethz.ch> | 2022-09-26 19:36:27 +0200 |
---|---|---|
committer | Andrea Lepori <alepori@student.ethz.ch> | 2022-09-26 19:36:27 +0200 |
commit | fce95cb32394b449bd6a17e766daf0cc6442db49 (patch) | |
tree | 5011464801d61b57017768ecbda123a900a123c2 /client/views.py | |
parent | switch tab on the profile based on missing fields (diff) | |
download | scout-subs-fce95cb32394b449bd6a17e766daf0cc6442db49.tar.gz scout-subs-fce95cb32394b449bd6a17e766daf0cc6442db49.zip |
create model to hide doctype from specific group
Diffstat (limited to 'client/views.py')
-rw-r--r-- | client/views.py | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/client/views.py b/client/views.py index bf2a641..d4e9709 100644 --- a/client/views.py +++ b/client/views.py @@ -1,7 +1,7 @@ from django.db.models.expressions import OuterRef, Subquery from django.template.loader import get_template from django.urls import reverse -from client.models import UserCode, Keys, DocumentType, Document, PersonalData, KeyVal, MedicalData +from client.models import HideGroup, UserCode, Keys, DocumentType, Document, PersonalData, KeyVal, MedicalData from django.db.models import Q from django.http import HttpResponseRedirect, FileResponse from django.contrib.auth.decorators import login_required @@ -130,6 +130,7 @@ def create(request): # remove from the list documents from already used types doctypes = DocumentType.objects.filter(filter).values_list("id", flat=True).difference(Document.objects.filter(Q(user=request.user) & ~Q(status="archive")).select_related("document_type").values_list("document_type", flat=True)) + doctypes = doctypes.difference(HideGroup.objects.filter(group__name__in=parent_groups).select_related("doc_type").values_list("doc_type", flat=True)) context['docs'] = DocumentType.objects.filter(id__in=doctypes) if request.method == "POST": |