From 61c861546bdbae694f22e2c54e9ca0f42331cae1 Mon Sep 17 00:00:00 2001 From: Chris Beaven Date: Thu, 3 Jan 2013 11:32:10 +1300 Subject: [PATCH] [1.5.x] Update doc example for overriding change_form.html Slightly reworded another related paragraph for clarity, too. Backport of 3f890f8. --- docs/ref/contrib/admin/index.txt | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/docs/ref/contrib/admin/index.txt b/docs/ref/contrib/admin/index.txt index 6f79e97a3ce..679b0b62e03 100644 --- a/docs/ref/contrib/admin/index.txt +++ b/docs/ref/contrib/admin/index.txt @@ -1825,31 +1825,32 @@ Because of the modular design of the admin templates, it is usually neither necessary nor advisable to replace an entire template. It is almost always better to override only the section of the template which you need to change. -To continue the example above, we want to add a new link next to the ``History`` -tool for the ``Page`` model. After looking at ``change_form.html`` we determine -that we only need to override the ``object-tools`` block. Therefore here is our -new ``change_form.html`` : +To continue the example above, we want to add a new link next to the +``History`` tool for the ``Page`` model. After looking at ``change_form.html`` +we determine that we only need to override the ``object-tools-items`` block. +Therefore here is our new ``change_form.html`` : .. code-block:: html+django {% extends "admin/change_form.html" %} - {% load i18n %} - {% block object-tools %} - {% if change %}{% if not is_popup %} - - {% endif %}{% endif %} {% endblock %} And that's it! If we placed this file in the ``templates/admin/my_app`` -directory, our link would appear on every model's change form. +directory, our link would appear on the change form for all models within +my_app. Templates which may be overridden per app or model --------------------------------------------------