diff options
author | Andrea Lepori <alepori@student.ethz.ch> | 2020-07-28 20:40:06 +0200 |
---|---|---|
committer | Andrea Lepori <alepori@student.ethz.ch> | 2020-07-28 20:40:06 +0200 |
commit | 8c8981891e1fccc4a4491ffe02c26a9d4279f0e6 (patch) | |
tree | 7f73b6ae37bfa9edf43aae177e6b4fb0b66feb4c /server/views.py | |
parent | about page and licence (diff) | |
download | scout-subs-8c8981891e1fccc4a4491ffe02c26a9d4279f0e6.tar.gz scout-subs-8c8981891e1fccc4a4491ffe02c26a9d4279f0e6.zip |
local font feching, list for non interactive items
Diffstat (limited to 'server/views.py')
-rw-r--r-- | server/views.py | 21 |
1 files changed, 7 insertions, 14 deletions
diff --git a/server/views.py b/server/views.py index e4b70ff..c634e6b 100644 --- a/server/views.py +++ b/server/views.py @@ -17,29 +17,21 @@ import pdfkit from io import BytesIO import os, base64 -# Create your views here. - @staff_member_required def index(request): context = {} parent_group = request.user.groups.values_list('name', flat=True)[ 0] - users = User.objects.filter(groups__name=parent_group) + users = User.objects.filter(groups__name=parent_group).order_by("id") users_out = [] + for user in users: - code = "" - if len(UserCode.objects.filter(user=user)) > 0: - code = 'U' + str(UserCode.objects.filter(user=user)[0].code) - status = "" - if user.is_staff: - status = "Staff" - elif user.has_perm("client.approved"): - status = "Attivo" - else: - status = "In attesa" + if not user.has_perm("client.approved") and not user.is_staff: + continue + users_out.append([user.username, user.first_name, - user.last_name, code, status]) + user.last_name]) parent_group = request.user.groups.values_list('name', flat=True)[ 0] @@ -168,6 +160,7 @@ def ulist(request): content_type = ContentType.objects.get_for_model(Document) permission = Permission.objects.get(content_type=content_type, codename="approved") user.user_permissions.remove(permission) + return HttpResponseRedirect("ulist") users = User.objects.filter(groups__name=parent_group).order_by("first_name") out = [] |