Fixed #12694 -- Added template block to make it easier to add new tools to the change_list and change_form templates. Thanks to andybak for the suggestion, and Simon Meers for the final patch.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@14795 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Russell Keith-Magee 2010-12-04 05:35:15 +00:00
parent ae7213b593
commit 79adb51514
2 changed files with 12 additions and 7 deletions

View File

@ -26,8 +26,11 @@
{% block content %}<div id="content-main"> {% block content %}<div id="content-main">
{% block object-tools %} {% block object-tools %}
{% if change %}{% if not is_popup %} {% if change %}{% if not is_popup %}
<ul class="object-tools"><li><a href="history/" class="historylink">{% trans "History" %}</a></li> <ul class="object-tools">
{% block object-tools-items %}
<li><a href="history/" class="historylink">{% trans "History" %}</a></li>
{% if has_absolute_url %}<li><a href="../../../r/{{ content_type_id }}/{{ object_id }}/" class="viewsitelink">{% trans "View on site" %}</a></li>{% endif%} {% if has_absolute_url %}<li><a href="../../../r/{{ content_type_id }}/{{ object_id }}/" class="viewsitelink">{% trans "View on site" %}</a></li>{% endif%}
{% endblock %}
</ul> </ul>
{% endif %}{% endif %} {% endif %}{% endif %}
{% endblock %} {% endblock %}

View File

@ -58,11 +58,13 @@
{% block object-tools %} {% block object-tools %}
{% if has_add_permission %} {% if has_add_permission %}
<ul class="object-tools"> <ul class="object-tools">
{% block object-tools-items %}
<li> <li>
<a href="add/{% if is_popup %}?_popup=1{% endif %}" class="addlink"> <a href="add/{% if is_popup %}?_popup=1{% endif %}" class="addlink">
{% blocktrans with cl.opts.verbose_name as name %}Add {{ name }}{% endblocktrans %} {% blocktrans with cl.opts.verbose_name as name %}Add {{ name }}{% endblocktrans %}
</a> </a>
</li> </li>
{% endblock %}
</ul> </ul>
{% endif %} {% endif %}
{% endblock %} {% endblock %}