aboutsummaryrefslogtreecommitdiffstats
path: root/client/views.py
diff options
context:
space:
mode:
authorAndrea Lepori <alepori@student.ethz.ch>2020-12-10 15:23:38 +0100
committerAndrea Lepori <alepori@student.ethz.ch>2020-12-10 15:23:38 +0100
commit22cbc05be615e10d7c766dee8b865182f919677d (patch)
tree4e8d32df20c7c78a74e366dfadb584762ee49d0b /client/views.py
parentall admin page use lazyload for images (diff)
downloadscout-subs-22cbc05be615e10d7c766dee8b865182f919677d.tar.gz
scout-subs-22cbc05be615e10d7c766dee8b865182f919677d.zip
lazyload of images in non admin page
Diffstat (limited to '')
-rw-r--r--client/views.py14
1 files changed, 7 insertions, 7 deletions
diff --git a/client/views.py b/client/views.py
index 821bc9b..b6e9832 100644
--- a/client/views.py
+++ b/client/views.py
@@ -101,24 +101,24 @@ def index(request):
medical = None
vac_file = ""
health_file = ""
+ sign_doc_file = ""
if i.personal_data:
personal = i.personal_data
if i.medical_data:
medical = i.medical_data
-
if medical.vac_certificate.name:
- with open(medical.vac_certificate.name, 'rb') as image_file:
- vac_file = base64.b64encode(image_file.read()).decode()
+ vac_file = "/server/media/" + str(i.id) + "/vac_certificate/doc"
if medical.health_care_certificate.name:
- with open(medical.health_care_certificate.name, 'rb') as image_file:
- health_file = base64.b64encode(
- image_file.read()).decode()
+ health_file = "/server/media/" + str(i.id) + "/health_care_certificate/doc"
+
+ if i.signed_doc:
+ sign_doc_file = "/server/media/" + str(i.id) + "/signed_doc/doc"
doc_group = i.user.groups.values_list('name', flat=True)[0]
out.append([i, KeyVal.objects.filter(container=i),
- personal, medical, doc_group, vac_file, health_file])
+ personal, medical, doc_group, vac_file, health_file, sign_doc_file])
context = {
"docs": out,