diff options
author | Andrea Lepori <alepori@student.ethz.ch> | 2022-09-13 19:31:23 +0200 |
---|---|---|
committer | Andrea Lepori <alepori@student.ethz.ch> | 2022-09-13 19:31:23 +0200 |
commit | 4a763d7b4b5d9694ac6a9c72cff794a5fb86b7f2 (patch) | |
tree | 7347577e2cfa11c0864ee9c8653cdaf931bb9bf0 | |
parent | account creation use default error text (diff) | |
download | scout-subs-4a763d7b4b5d9694ac6a9c72cff794a5fb86b7f2.tar.gz scout-subs-4a763d7b4b5d9694ac6a9c72cff794a5fb86b7f2.zip |
permit multiple documents of the same type
-rw-r--r-- | client/views.py | 4 | ||||
-rw-r--r-- | version.txt | 2 |
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 |