aboutsummaryrefslogtreecommitdiffstats
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
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
-rw-r--r--version.txt2
2 files changed, 3 insertions, 3 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("/")
diff --git a/version.txt b/version.txt
index 6239158..78ab950 100644
--- a/version.txt
+++ b/version.txt
@@ -1,2 +1,2 @@
version=0.6
-rev=3
+rev=4