Reputation: 1765
I needed to add a button in the admin interface just before an Inline. What I've made is add the following in change_form:
{% block after_field_sets %}
<input type="button" value="Add contract" onClick=" window.location.href='../../contract/add/' ">
{% endblock %}
But...now the button is shown in every model page of the admin interface not just in the page of the Inline.
Any suggestion?
Upvotes: 1
Views: 823
Reputation: 45585
You can override the template for desired model only. So template should be templates/admin/my_app/my_model/change_form.html
instead of simple templates/admin/change_form.html
Upvotes: 5