Add a new view that returns the files.  Connect the “Download” button to the 
URL to that view.
Your view should return an HttpResponse object.  For instance, I use this for 
the user to download PDF versions of forms:

response = HttpResponse(pdf_contents, content_type='application/pdf')
response['Content-Disposition'] = "%sfilename=%s" % ('attachment; ' if download 
else '', filename)
return response

For pptx, your content_type would be:

'.pptx': 
'application/vnd.openxmlformats-officedocument.presentationml.presentation',


From: [email protected] [mailto:[email protected]] On 
Behalf Of Balu Nanduri
Sent: Monday, April 16, 2018 2:48 PM
To: Django users
Subject: Need Help With integrating Python Scripts with Django Frame Work

Hi,
         I am working on a project where I have to communicate with Tableau 
server and generate pptx with the images downloaded. I have a working script to 
do this piece, currently the script generates pptx and stores it to my local 
filesystem.

Now I would like to create a web page which would accept necessary input from 
users and should trigger the script which generates pptx and then downloads the 
files to the user's browser.

I had set up DJANGO environment of the same but not getting how to call this 
script from the web page so, could anyone help me out with a overview on how 
can I call my working script on click of a button and download the files 
generated by the script.

Thanks & Regards
Balu
--
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 
[email protected]<mailto:[email protected]>.
To post to this group, send email to 
[email protected]<mailto:[email protected]>.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/b5471890-0cd8-4ee7-a7c5-c43840590a4d%40googlegroups.com<https://groups.google.com/d/msgid/django-users/b5471890-0cd8-4ee7-a7c5-c43840590a4d%40googlegroups.com?utm_medium=email&utm_source=footer>.
For more options, visit https://groups.google.com/d/optout.

-- 
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 [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/02eb6190ff484840b8729f146bb3e166%40ISS1.ISS.LOCAL.
For more options, visit https://groups.google.com/d/optout.

Reply via email to