3👍
✅
I figured it out, I used the following;
self.helper.add_input(Button('cancel', "Cancel", css_class='btn', onclick="javascript:location.href = '/customeroverview';"))
2👍
This page has another way:
HTML("""<a role="button" class="btn btn-default"
href="{% url "some_cancel_url" %}">Cancel</a>"""),
So some_cancel_url
is the name of the url you want to go to.
Seems a little hackish, but I think an anchor is better than javascript. Better for search engines, people without JS or simply for checking out the link by hovering.
👤Mark
- [Django]-Django ModelForm initial or custom field value
- [Django]-Searching for a project skeleton for Chef + Django on Linux
- [Django]-How to solve the did not return httpresonse error with django?
Source:stackexchange.com