aboutsummaryrefslogtreecommitdiffstats
path: root/client/views.py
diff options
context:
space:
mode:
authorAndrea Lepori <alepori@student.ethz.ch>2022-09-13 19:31:23 +0200
committerAndrea Lepori <alepori@student.ethz.ch>2022-09-13 19:31:23 +0200
commit4a763d7b4b5d9694ac6a9c72cff794a5fb86b7f2 (patch)
tree7347577e2cfa11c0864ee9c8653cdaf931bb9bf0 /client/views.py
parentaccount creation use default error text (diff)
downloadscout-subs-4a763d7b4b5d9694ac6a9c72cff794a5fb86b7f2.tar.gz
scout-subs-4a763d7b4b5d9694ac6a9c72cff794a5fb86b7f2.zip
permit multiple documents of the same type
Diffstat (limited to '')
-rw-r--r--client/views.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/client/views.py b/client/views.py
index deeb93c..4cb3d3d 100644
--- a/client/views.py
+++ b/client/views.py
@@ -130,7 +130,7 @@ def create(request):
filter = filter & Q(staff_only=False)
# remove from the list documents from already used types
- doctypes = DocumentType.objects.filter(filter).values_list("id", flat=True).difference(Document.objects.filter(user=request.user).select_related("document_type").values_list("document_type", flat=True))
+ 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))
context['docs'] = DocumentType.objects.filter(id__in=doctypes)
if request.method == "POST":
@@ -183,7 +183,7 @@ def create(request):
return HttpResponseRedirect("/")
# get list of docs with that type
- current_docs = Document.objects.filter(user=request.user).filter(document_type=document_type)
+ current_docs = Document.objects.filter(user=request.user).filter(Q(document_type=document_type) & ~Q(status="archive"))
if len(current_docs) > 0:
# if there is already a document with that type abort (user is cheating)
return HttpResponseRedirect("/")