﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
12694	Adding an object-tool requires template code duplication	Andy Baker	Simon Meers	"Currently adding an object tool to an admin change list template requires that you duplicate the following:


{{{
    {% block object-tools %}
      {% if has_add_permission %}
        <ul class=""object-tools"">
          <li>
            <a href=""add/{% if is_popup %}?_popup=1{% endif %}"" class=""addlink"">
              {% blocktrans with cl.opts.verbose_name as name %}Add {{ name }}{% endblocktrans %}
            </a>
          </li>
        </ul>
      {% endif %}
    {% endblock %}
}}}


It's much more likely that someone will want to merely add an object tool rather than replace the existing ones. Therefore an empty block before the first <li> would allow for cleaner template inheritance and reduce problems when upgrading Django installs. My install of Django is patched as follows:

{{{

    {% block object-tools %}
        <ul class=""object-tools"">
          {% block pre-object-tools %}{% endblock %}
            {% if has_add_permission %}
              <li>
                <a href=""add/{% if is_popup %}?_popup=1{% endif %}"" class=""addlink"">
                  {% blocktrans with cl.opts.verbose_name as name %}Add {{ name }}{% endblocktrans %}
                </a>
              </li>
          {% endif %}
        {% block post-object-tools %}{% endblock %}
        </ul>
    {% endblock %}
}}}
"	Cleanup/optimization	closed	contrib.admin	dev	Normal	fixed	admin, blocks, template, object-tools, sprintdec2010	andy@…	Ready for checkin	1	0	0	0	0	0
