aboutsummaryrefslogtreecommitdiffstats
path: root/client/views.py
diff options
context:
space:
mode:
Diffstat (limited to 'client/views.py')
-rw-r--r--client/views.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/client/views.py b/client/views.py
index b1b8297..57747ee 100644
--- a/client/views.py
+++ b/client/views.py
@@ -49,9 +49,11 @@ def index(request):
context = {'doc': document}
html = template.render(context)
pdf = pdfkit.from_string(html, False)
- result = BytesIO(pdf)
- result.seek(0)
- return FileResponse(result, as_attachment=True, filename=document.document_type.name+".pdf")
+ # build response
+ filename = document.document_type.name + ".pdf"
+ response = HttpResponse(pdf, content_type='application/pdf')
+ response['Content-Disposition'] = 'attachment; filename="' + filename + '"'
+ return response
elif request.POST["action"][0] == 'a':
# sign autosign doc
if document.status == "autosign":