diff options
author | Andrea Lepori <alepori@student.ethz.ch> | 2022-03-23 19:10:35 +0100 |
---|---|---|
committer | Andrea Lepori <alepori@student.ethz.ch> | 2022-03-23 19:10:47 +0100 |
commit | 7926fee19b2241e2f3facef8b6eb8789f5d97d49 (patch) | |
tree | 0ddc4a687feb0ec0e8e81003248905f26ca1c3cc /client/templatetags/app_filter.py | |
parent | add option to disable oauth (diff) | |
download | scout-subs-7926fee19b2241e2f3facef8b6eb8789f5d97d49.tar.gz scout-subs-7926fee19b2241e2f3facef8b6eb8789f5d97d49.zip |
initial support of user switcher
Diffstat (limited to 'client/templatetags/app_filter.py')
-rw-r--r-- | client/templatetags/app_filter.py | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/client/templatetags/app_filter.py b/client/templatetags/app_filter.py index df92775..c447d35 100644 --- a/client/templatetags/app_filter.py +++ b/client/templatetags/app_filter.py @@ -2,6 +2,8 @@ from django import template from django.db.models.query_utils import Q from client.models import Document, KeyVal, Keys +import json + register = template.Library() @register.filter(name="doc_key") def doc_key(doc): @@ -46,4 +48,11 @@ def parse_multiple_choice(str): if len(arr) < 2: return [arr[0], []] - return [arr[0], arr[1:]]
\ No newline at end of file + return [arr[0], arr[1:]] + +@register.filter(name="parse_userswitcher") +def parse_userswitcher(str): + if not str: + return [] + + return json.loads(str).keys()
\ No newline at end of file |