Opened 18 years ago
Closed 18 years ago
#3128 closed enhancement (fixed)
[patch] add an object_tools block to admin templates
Reported by: | Owned by: | Adrian Holovaty | |
---|---|---|---|
Component: | contrib.admin | Version: | dev |
Severity: | normal | Keywords: | |
Cc: | gary.wilson@… | Triage Stage: | Unreviewed |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
Currently, if I want to add object tools I have you have to override all of block content:
{% block content %} <div id="content-main"> <ul class="object-tools"> {% if has_add_permission %} <li><a href="add/{% if is_popup %}?_popup=1{% endif %}" class="addlink">{% blocktrans with cl.opts.verbose_name|escape as name %}Add {{ name }}{% endblocktrans %}</a></li> <li><a href="myaction">Myaction</a></li> {% endif %} </ul> <div class="module{% if cl.has_filters %} filtered{% endif %}" id="changelist"> {% block search %}{% search_form cl %}{% endblock %} {% block date_hierarchy %}{% date_hierarchy cl %}{% endblock %} {% block filters %}{% filters cl %}{% endblock %} {% block result_list %}{% result_list cl %}{% endblock %} {% block pagination %}{% pagination cl %}{% endblock %} </div> </div> {% endblock %}
With a {% block object_tools %}, it could just be:
{% block object_tools %} <ul class="object-tools"> {% if has_add_permission %} <li><a href="add/{% if is_popup %}?_popup=1{% endif %}" class="addlink">{% blocktrans with cl.opts.verbose_name|escape as name %}Add {{ name }}{% endblocktrans %}</a></li> <li><a href="myaction">Myaction</a></li> {% endif %} </ul> {% endblock %}
The object tools area seems to be one of the only places that doesn't already have a block.
Attachments (2)
Change History (6)
by , 18 years ago
Attachment: | change_list.diff added |
---|
comment:1 by , 18 years ago
comment:2 by , 18 years ago
Summary: | [patch] add an object_tools block to change_list.html template → [patch] add an object_tools block to admin templates |
---|
not just change_list.html
by , 18 years ago
Attachment: | object-tools-block.diff added |
---|
block in admin/base.html with overrides in change_list and change_form
comment:3 by , 18 years ago
Cc: | added |
---|
comment:4 by , 18 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
Note:
See TracTickets
for help on using tickets.
some discussion at http://groups.google.com/group/django-developers/browse_thread/thread/a932ebacae699064/ed20974246c0925e