On Wed, Mar 20, 2013 at 2:27 PM, Felipe Prenholato <philipe...@gmail.com> wrote: > When page loads (document.ready), do a ajax call to a view that returns PDF > file.
How is a PDF file involved here? > 2013/3/20 Larry Martell <larry.mart...@gmail.com> >> >> On Wed, Mar 20, 2013 at 5:34 AM, Tom Evans <tevans...@googlemail.com> >> wrote: >> > On Wed, Mar 20, 2013 at 11:28 AM, Larry Martell >> > <larry.mart...@gmail.com> wrote: >> >> Yes, I have convinced them to not require this. Now my issue is how to >> >> cause a file to be saved and to also render a template. When I return >> >> this: >> >> >> >> response = HttpResponse('This is what I want to save') >> >> response['Content-Type'] = 'application/gzip' >> >> response['Content-disposition'] = 'Attachment; >> >> filename=export.gzip' >> >> return response >> >> >> >> my template is obviously not rendered. How can I do this and also >> >> render my template at the same time? >> >> >> > >> > Use render() shortcut to generate a response and set the appropriate >> > attributes on it before returning the response. Eg: >> > >> > response = render(request, 'my_template.html', { }) >> > response['Content-Type'] = 'application/gzip' >> > response['Content-disposition'] = 'Attachment; filename=export.gzip' >> > return response >> >> This is downloading a file, but the file that gets downloaded is not >> export.gzip, but instead is a copy of my rendered template and my >> template is not rendered in my browser. >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Django users" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to django-users+unsubscr...@googlegroups.com. >> To post to this group, send email to django-users@googlegroups.com. >> Visit this group at http://groups.google.com/group/django-users?hl=en. >> For more options, visit https://groups.google.com/groups/opt_out. >> >> > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to django-users+unsubscr...@googlegroups.com. > To post to this group, send email to django-users@googlegroups.com. > Visit this group at http://groups.google.com/group/django-users?hl=en. > For more options, visit https://groups.google.com/groups/opt_out. > > -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users?hl=en. For more options, visit https://groups.google.com/groups/opt_out.