Enhancing https://stackoverflow.com/posts/65938495/
It is also possible to override/extend the innermost {% block submit-row %}
like so:
{% extends 'admin/submit_line.html' %}
{% load i18n admin_urls %}
{% block submit-row %}
{% if extra_button_allowed %}
<input type="submit" value="Get me tea" name="_get_tea" />
{% endif %}
{{ block.super }}
{% endblock %}
This way you maintain the original behaviour of the 'Save' buttons.
The submit-row
block comes from the django/contrib/admin/templates/admin/submit_line.html
template.
As noted by @peter-kilczuk you have to save this to a folder named templates/admin/<your-app>/<yourmodelname>/submit_line.html
; no need to set the change_form_template
in your ModelAdmin
class.
NOTE that yourmodelname
is the slug name of YourModelName
and all characters are in lowercase