aboutsummaryrefslogtreecommitdiffstats
path: root/server/views.py
diff options
context:
space:
mode:
authorAndrea Lepori <alepori@student.ethz.ch>2022-08-06 21:46:44 +0200
committerAndrea Lepori <alepori@student.ethz.ch>2022-08-06 21:46:44 +0200
commit15a57cbb39634b42bec54d9c88d20611e0780b31 (patch)
treeaf2f5e7a146c070c5bd1688cd84cbbbabb28d728 /server/views.py
parentfix incorect parsing of approval code (diff)
downloadscout-subs-15a57cbb39634b42bec54d9c88d20611e0780b31.tar.gz
scout-subs-15a57cbb39634b42bec54d9c88d20611e0780b31.zip
fix heading prefix and add custom param preview
Diffstat (limited to 'server/views.py')
-rw-r--r--server/views.py25
1 files changed, 25 insertions, 0 deletions
diff --git a/server/views.py b/server/views.py
index 7643bee..35fb232 100644
--- a/server/views.py
+++ b/server/views.py
@@ -610,6 +610,31 @@ def doctype(request):
}
return render(request, 'server/doc_type.html', context)
+@user_passes_test(isStaff)
+def custom_parameters_preview(request):
+ context = {}
+ if "param" not in request.GET:
+ return render(request, 'server/doc_creation_preview.html', context)
+
+ params = request.GET["param"]
+ params = base64.b64decode(params).decode("utf-8")
+ params = params.splitlines()
+ keys = []
+ for i in range(len(params)):
+ dic = {}
+ val = params[i]
+ if val.startswith("!"):
+ if len(val) < 3:
+ val = val
+
+ val = val[3:].split(",")[0]
+ dic["key"] = val
+ dic["key_extra"] = params[i]
+ dic["id"] = i
+ keys.append(dic)
+
+ context["keys"] = keys
+ return render(request, 'server/doc_creation_preview.html', context)
@user_passes_test(isStaff)
def doccreate(request):