diff options
author | Andrea Lepori <alepori@student.ethz.ch> | 2020-08-29 14:51:39 +0200 |
---|---|---|
committer | Andrea Lepori <alepori@student.ethz.ch> | 2020-08-29 14:51:39 +0200 |
commit | 6f067ec9a3d6e3c62c0214cdb1bd18f4d2c43905 (patch) | |
tree | f5737da4c8e3c2fff85f1f87897620c2f9c728c3 /client | |
parent | pdf download on mobile (diff) | |
download | scout-subs-6f067ec9a3d6e3c62c0214cdb1bd18f4d2c43905.tar.gz scout-subs-6f067ec9a3d6e3c62c0214cdb1bd18f4d2c43905.zip |
revert to previous download method
Diffstat (limited to 'client')
-rw-r--r-- | client/views.py | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/client/views.py b/client/views.py index cb595e8..11ff367 100644 --- a/client/views.py +++ b/client/views.py @@ -49,12 +49,9 @@ def index(request): context = {'doc': document} html = template.render(context) pdf = pdfkit.from_string(html, False) - # build response - filename = document.document_type.name + ".pdf" - response = HttpResponse(pdf, content_type='application/pdf') - response['Content-Disposition'] = 'attachment; filename="' + filename + '"' - response['Content-Length'] = len(pdf) - return response + result = BytesIO(pdf) + result.seek(0) + return FileResponse(result, filename=document.document_type.name+".pdf") elif request.POST["action"][0] == 'a': # sign autosign doc if document.status == "autosign": |