Re: returning a zip file for download

2018-02-20 Thread Ryan Nowakowski
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

Re: returning a zip file for download

2018-02-20 Thread Iago Otero
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

Re: returning a zip file for download

2012-08-01 Thread Tomas Neme
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'] =

Re: returning a zip file for download

2012-07-31 Thread Javier Guerra Giraldez
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

Re: returning a zip file for download

2012-07-31 Thread Nikolas Stevenson-Molnar
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