diff options
Diffstat (limited to '')
-rw-r--r-- | client/templatetags/app_filter.py | 11 | ||||
-rw-r--r-- | client/views.py | 2 |
2 files changed, 11 insertions, 2 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 diff --git a/client/views.py b/client/views.py index 5333ddb..086c1ba 100644 --- a/client/views.py +++ b/client/views.py @@ -2,7 +2,7 @@ from django.db.models.expressions import OuterRef, Subquery from django.template.loader import get_template from client.models import GroupSettings, UserCode, Keys, DocumentType, Document, PersonalData, KeyVal, MedicalData from django.db.models import Q -from django.http import HttpResponseRedirect, FileResponse +from django.http import HttpResponse, HttpResponseRedirect, FileResponse from django.contrib.auth.decorators import login_required from django.shortcuts import render from accounts.views import copy_from_midata |