0

I would like to add custom button next to the buttons save or save and continue in DjangoAdmin. When I click on it I would like to show another registered model in django admin.

In submit_line.html I have add my custom button and then I display it in my modelAdmin definition in changeform_view. How could I make link to another model? How could I override function in submit_line.html (f.e. _save)?

Thanks.

{% load i18n admin_urls %}
<div class="submit-row">
  {% if show_save %}<input type="submit" value="{% trans 'Save' %}" 
   class="default" name="_save" />{% endif %}

  {% if show_custom %}<input type="submit" value="{% trans 'Custom button' %}" 
   class="default" name="_custom" />{% endif %}
...
</div>
Erko
  • 55
  • 1
  • 1
  • 7

1 Answers1

0

The solution to add another button is here: Create custom buttons in admin change_form in Django

You can add your url easily to the button using the reverse of the django admin: https://docs.djangoproject.com/en/2.0/ref/contrib/admin/#reversing-admin-urls

Karim N Gorjux
  • 2,880
  • 22
  • 29