From 9bb7b7bdfaf4130e1fa8e5f9baf93e9f977f7807 Mon Sep 17 00:00:00 2001 From: Andrea Lepori Date: Wed, 29 Jul 2020 23:58:25 +0200 Subject: upload signed documents --- accounts/views.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'accounts') diff --git a/accounts/views.py b/accounts/views.py index 31786b1..a31d12b 100644 --- a/accounts/views.py +++ b/accounts/views.py @@ -123,11 +123,10 @@ def personal(request): if "vac_certificate" in request.FILES: myfile = request.FILES['vac_certificate'] - medic.save() try: im = Image.open(myfile) im_io = BytesIO() - im.save(im_io, 'WEBP', quality=70) + im.save(im_io, 'WEBP', quality=50) medic.vac_certificate.save(request.user.username+"_"+myfile.name, im_io) medic.save() except UnidentifiedImageError: @@ -139,7 +138,7 @@ def personal(request): try: im = Image.open(myfile) im_io = BytesIO() - im.save(im_io, 'WEBP', quality=70) + im.save(im_io, 'WEBP', quality=50) medic.health_care_certificate.save(request.user.username+"_"+myfile.name, im_io) medic.save() except UnidentifiedImageError: @@ -155,6 +154,9 @@ def personal(request): medic.health_care_certificate = None medic.save() + if not error: + return HttpResponseRedirect("") + if len(request.user.groups.values_list('name', flat=True)) == 0: branca_default = "selected" else: -- cgit v1.2.1