associating save link with button

31 views
Skip to first unread message

Larry Martell

unread,
Aug 8, 2016, 7:18:45 PM8/8/16
to django...@googlegroups.com
Not really a django question but I'm hoping someone can help me here.

I have a django app but the html is not displayed in a browser -
render_to_string is called and the html is returned in a response to
custom app that displays the page. On the page I have a button that
sends a request back to the server. When I click the button in the
page within the custom app app the request is sent, but the app does
not wait for the reply. However if I right click on the button and
select "Save link ...' then the app does wait for the reply and it all
works as I want.

Is there some way I can associate the "Save link ...' action with the
button so that clicking on it will function the same as when right
click save link is selected?

M Hashmi

unread,
Aug 9, 2016, 7:04:10 AM8/9/16
to Django users
Please paste code.

Larry Martell

unread,
Aug 9, 2016, 3:13:55 PM8/9/16
to django...@googlegroups.com
I figured this out. I just had to add 'download' to the <a> tag:

<a href="{% url 'core.reports.views.download' the_controller.app.name
the_controller.get_name %}?report_id={{ encounters.0.report_id }}"
class="btn btn-primary" download>Export</a>

M Hashmi

unread,
Aug 10, 2016, 3:02:14 AM8/10/16
to django...@googlegroups.com
Great Larry.
Good luck.

--
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+unsubscribe@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
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/CACwCsY63wUzckeckOsR3wU7htezHqQVBoLdKUgahe-0AGutBwQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages