Skip to content

All about default Django object tools

Chris Chang edited this page May 28, 2025 · 1 revision

My notes to remind myself how to do Django object tools the old fashioned way.

change_form.html

This is the detail template in the Django admin we hook into. It looks like:

  <ul class="object-tools">
    {% block object-tools-items %}
      {% change_form_object_tools %}
    {% endblock %}
  </ul>

Versions: 4.2 - 5.2 https://github.com/django/django/blob/stable/4.2.x/django/contrib/admin/templates/admin/change_form.html

change_form_object_tools

This tag renders change_form_object_tools.html which just inserts base <li> tags into the parent <ul>: "History" and "View on Site".

https://github.com/django/django/blob/stable/4.2.x/django/contrib/admin/templatetags/admin_modify.py#L122-L130 https://github.com/django/django/blob/stable/5.2.x/django/contrib/admin/templates/admin/change_form_object_tools.html

Clone this wiki locally