diff options
author | Andrea Lepori <alepori@student.ethz.ch> | 2020-08-27 20:51:40 +0200 |
---|---|---|
committer | Andrea Lepori <alepori@student.ethz.ch> | 2020-08-27 20:51:40 +0200 |
commit | 3a24ed97b18c0843f7d989fbc5df91002a110955 (patch) | |
tree | e2b0db21fee9b0ddcf7af6f6ae5ddc9d3e215956 | |
parent | comment code, minor bug fixes (diff) | |
download | scout-subs-3a24ed97b18c0843f7d989fbc5df91002a110955.tar.gz scout-subs-3a24ed97b18c0843f7d989fbc5df91002a110955.zip |
download images in jpeg, small improvements
Diffstat (limited to '')
-rw-r--r-- | accounts/templates/accounts/terms.html | 4 | ||||
-rw-r--r-- | accounts/views.py | 20 | ||||
-rw-r--r-- | client/templates/client/approve_doc_pdf.html | 5 | ||||
-rw-r--r-- | client/templates/client/index.html | 5 |
4 files changed, 26 insertions, 8 deletions
diff --git a/accounts/templates/accounts/terms.html b/accounts/templates/accounts/terms.html index c72e006..7a7b461 100644 --- a/accounts/templates/accounts/terms.html +++ b/accounts/templates/accounts/terms.html @@ -14,8 +14,8 @@ <div class="card-content"> <h5>Termini e condizioni</h5> <blockquote> - Termine 1 ecc...... - Cose + Creando un account accetti e comprendi i seguenti termini: <br> + Tutti i dati inseriti all'interno del sistema verranno condivisi con la persona a capo del gruppo di cui fai parte. </blockquote> </div> </div> diff --git a/accounts/views.py b/accounts/views.py index 50266b1..9b5884b 100644 --- a/accounts/views.py +++ b/accounts/views.py @@ -77,7 +77,13 @@ def personal(request): if filename.rfind('.') != -1: filename = filename[:filename.rfind('.')] filename = filename + ".jpg" - return FileResponse(medic.vac_certificate.file, as_attachment=True, filename=filename) + + # encode in JPEG + im = Image.open(medic.vac_certificate.file) + im_io = BytesIO() + im.save(im_io, 'JPEG', quality=90) + im_io.seek(0) + return FileResponse(im_io, as_attachment=True, filename=filename) if request.POST['action'] == "download_health": if medic.health_care_certificate != None: @@ -86,7 +92,13 @@ def personal(request): if filename.rfind('.') != -1: filename = filename[:filename.rfind('.')] filename = filename + ".jpg" - return FileResponse(medic.health_care_certificate.file, as_attachment=True, filename=filename) + + # encode in JPEG + im = Image.open(medic.vac_certificate.file) + im_io = BytesIO() + im.save(im_io, 'JPEG', quality=90) + im_io.seek(0) + return FileResponse(im_io, as_attachment=True, filename=filename) # set all attributes request.user.first_name = request.POST["first_name"] @@ -140,7 +152,7 @@ def personal(request): im = Image.open(myfile) im_io = BytesIO() # compress image in WEBP - im.save(im_io, 'WEBP', quality=50) + im.save(im_io, 'WEBP', quality=50, method=4) medic.vac_certificate.save( request.user.username+"_"+myfile.name, im_io) medic.save() @@ -154,7 +166,7 @@ def personal(request): im = Image.open(myfile) im_io = BytesIO() # compress image in WEBP - im.save(im_io, 'WEBP', quality=50) + im.save(im_io, 'WEBP', quality=50, method=4) medic.health_care_certificate.save( request.user.username+"_"+myfile.name, im_io) medic.save() diff --git a/client/templates/client/approve_doc_pdf.html b/client/templates/client/approve_doc_pdf.html index deabd99..56fb36e 100644 --- a/client/templates/client/approve_doc_pdf.html +++ b/client/templates/client/approve_doc_pdf.html @@ -19,8 +19,9 @@ <div class="row"> <div class="col s6 offset-s3"> <p>Con la presente firma approvo il documento con codice {{doc.code}} accettando - tutte le clausole apposte su di esso. - Inoltre comprovo come veritieri e completi tutti i dati apposti sul documento. + tutte le clausole apposte su di esso. <br> + Inoltre comprovo come veritieri e completi tutti i dati apposti sul documento. <br> + Nel caso in cui il documento comprendesse i dati medici autorizza i capi, in caso di emergenza, a intraprendere i passi necessari per dare avvio a cure mediche d’urgenza anche senza essere ulteriormente consultato/a. </p> </div> </div> diff --git a/client/templates/client/index.html b/client/templates/client/index.html index 1a63c2e..20ce2d3 100644 --- a/client/templates/client/index.html +++ b/client/templates/client/index.html @@ -84,6 +84,11 @@ <br> <br> {% endif %} + <ul class="collection"> + <li class="collection-item"> + <i class="material-icons left">confirmation_number</i>{{doc.0.code}} + </li> + </ul> <ul class="collapsible"> {% if doc.0.document_type.personal_data %} <li> |