To set the download filename, you'll need to set the response
Content-Disposition header[1] in your view:
response['Content-Disposition'] = 'attachment; filename="somefilename.zip"'
[1] https://docs.djangoproject.com/en/2.0/howto/outputting-pdf/#write-your-view
On Tue, Feb 20, 2018 at
and with puttin in de .would it work???.because if you have a def on
views.py with http response for the downloadand the correct
url.py..should work
El miércoles, 1 de agosto de 2012, 0:03:21 (UTC+2), Tomas Neme escribió:
>
>
> Down here's the code in which I'm creating
OK, I got it working, I'm not sure what the problem was, but calling the
loop variable 'file' was overriding the python default file object class
now I'm doing this:
response = HttpResponse(File(file(tmp[1])),
mimetype="application/zip")
response['Content-disposition'] =
On Tue, Jul 31, 2012 at 5:03 PM, Tomas Neme wrote:
> The weird thing is that I'm getting just a pdf file (ok, I'm testing with a
> single file, so I don't know if that's the problem)
shoot in the dark: maybe the browser is interpreting the zipped PDF as
a zip-encoded
I'm not sure why you're getting a PDF file back, but as for the
filename, you can set it using the Content-Disposition header. E.g:
response = return HttpResponse(open(tmp[1]), mimetype="application/zip")
response['Content-Disposition'] = 'attachment; filename="whatever.zip'
return response
_Nik
5 matches
Mail list logo