the whole object tools depend on has_add_permission

6 views
Skip to first unread message

Hadi Sunyoto

unread,
May 15, 2013, 7:07:21 AM5/15/13
to django...@googlegroups.com
what i want to do:
i want to add link beside add object in change_list.html
the link will be displayed only to selected groups

what i do is overriding the change_list.html block object-tools

from: change_list.html

{% block content %}
  <div id="content-main">
    {% block object-tools %}
      {% if has_add_permission %} <-- pos 1
        <ul class="object-tools"> <-- pos 2
          {% block object-tools-items %} <-- pos 3
            <li>
              <a href="{% url cl.opts|admin_urlname:'add' %}{% if is_popup %}?_popup=1{% endif %}" class="addlink">
                {% blocktrans with cl.opts.verbose_name as name %}Add {{ name }}{% endblocktrans %}
              </a>
            </li>
          {% endblock %}
        </ul>
      {% endif %}

But it seems that ul position should be in pos 1, and {%if has_add_permission %} should be in pos 3, while {% block object-tools-items %} should be in pos 2.

By having the current change_list, overriding object-tools-items, the link will be displayed ONLY has_add_permission, but that is not what i want

Is this a bug in change_list.html? i hope i make myself clear. thanks
Reply all
Reply to author
Forward
0 new messages