Am trying to add another custom button, and at the same time I want it to trigger certain processes in Django-admin with templates, below is how I have implemented the template :
{% extends 'admin/custominlines/change_form.html' %}
{% load i18n %}
{% block submit_buttons_bottom %}
{{ block.super }}
{% if request.GET.edit %}
<div class="submit-row">
<input type="submit" value="Custom button" name="_transition-states">
</div>
{% endif %}
{% endblock %}
The button does appear however, when I click it , it doesn't show the print I have inserted in the response_change()
function in the admin.py
, what am I missing here :
def response_change(self, request, obj):
if '_transition-states' in request.POST:
print("am working")
return super().response_change(request, obj)
When I click the button it just routes back to the previous page.