I'm new to Django!
I'm using Django Admin. How can I make a new button(near save,...) and post the information and use it in a python script(I am using Django version 2).
admin.py:
admin.site.register(Router)
admin.site.register(Peer, PeerModelAdmin)
admin.site.register(Prefixe, PrefixModelAdmin)
You need to override the change_form_template
. Try like this:
class YourModelAdmin(admin.ModelAdmin):
change_form_template = 'custom_change_form.html'
In custom_change_form.html
it should be extended from admin/change_form.html
and it can be like this:
{% load i18n %}
{% extends 'admin/change_form.html' %}
<button> Your Custom Button </button>
<input type="submit" value="{% trans 'Save' %}" class="default" name="_save">
{% endblock %}