aboutsummaryrefslogtreecommitdiffstats
path: root/server
diff options
context:
space:
mode:
authorAndrea Lepori <al@0hm.ch>2024-01-23 15:33:38 +0100
committerAndrea Lepori <al@0hm.ch>2024-01-23 15:33:38 +0100
commit17560c0e8183307f63e598039f72e46d2570c23f (patch)
treeee3994f7e484ccdbca61d3f49722f8cfff7eaa81 /server
parentfix not accessing user through usercode (diff)
downloadscout-subs-17560c0e8183307f63e598039f72e46d2570c23f.tar.gz
scout-subs-17560c0e8183307f63e598039f72e46d2570c23f.zip
show hidden types with unarchived docs
Diffstat (limited to '')
-rw-r--r--server/views.py12
1 files changed, 8 insertions, 4 deletions
diff --git a/server/views.py b/server/views.py
index 09ab79a..c06046d 100644
--- a/server/views.py
+++ b/server/views.py
@@ -728,9 +728,6 @@ def doctype(request):
if not selfsign:
public_types = public_types.filter(auto_sign=False)
selfsign_check = ""
- if not hidden:
- public_types = public_types.filter(enabled=True)
- hidden_check = ""
if not personal:
public_types = public_types.filter(personal_data=False)
personal_check = ""
@@ -747,16 +744,23 @@ def doctype(request):
public_types = public_types.filter(custom_group=False)
group_check = ""
+ if not hidden:
+ hidden_check = ""
+
users_capi = User.objects.filter(groups__name__contains="capi")
docs = []
for doc in public_types:
- doc_count = str(Document.objects.filter(document_type=doc).count())
+ doc_count_int = Document.objects.filter(document_type=doc).count()
+ doc_count = str(doc_count_int)
ref_docs_archived = Document.objects.filter(document_type=doc, status="archive").count()
if ref_docs_archived > 0:
doc_count += "-" + str(ref_docs_archived)
if doc.max_instances != 0:
doc_count += "/" + str(doc.max_instances)
+ if not hidden and doc.enabled == False and doc_count_int == ref_docs_archived:
+ continue
+
doc_obj = Document.objects.filter(document_type=doc).exclude(status="archive").select_related(
"usercode", "usercode__branca__name", "usercode__user__groups__name"
)