|
1 | 1 | {% extends "admin/change_form.html" %}
|
2 | 2 | {% load add_preserved_filters from admin_urls %}
|
| 3 | +{% load static %} |
| 4 | + |
| 5 | +{% block extrastyle %} |
| 6 | +{{ block.super }} |
| 7 | +<link rel="stylesheet" href="{% static 'django_object_actions/css/style.css' %}"> |
| 8 | +{% endblock %} |
3 | 9 |
|
4 | 10 | {% block object-tools-items %}
|
5 | 11 | {% for tool in objectactions %}
|
6 |
| - <li class="objectaction-item" data-tool-name="{{ tool.name }}"> |
7 |
| - {% url tools_view_name pk=object_id tool=tool.name as action_url %} |
8 |
| - <form name="{{ tool.name }}__form" method="post" action="{% add_preserved_filters action_url %}"> |
9 |
| - {% csrf_token %} |
10 |
| - <a href="javascript:window.document.forms['{{ tool.name }}__form'].submit()" title="{{ tool.standard_attrs.title }}" |
11 |
| - {% for k, v in tool.custom_attrs.items %} |
12 |
| - {{ k }}="{{ v }}" |
13 |
| - {% endfor %} |
14 |
| - class="{{ tool.standard_attrs.class }}"> |
15 |
| - {{ tool.label|capfirst }} |
16 |
| - </a> |
17 |
| - </form> |
18 |
| - </li> |
| 12 | + {% if not tool.form %} |
| 13 | + <li class="objectaction-item" data-tool-name="{{ tool.name }}"> |
| 14 | + {% url tools_view_name pk=object_id tool=tool.name as action_url %} |
| 15 | + <form name="{{ tool.name }}__form" method="post" action="{% add_preserved_filters action_url %}"> |
| 16 | + {% csrf_token %} |
| 17 | + <a href="javascript:window.document.forms['{{ tool.name }}__form'].submit()" title="{{ tool.standard_attrs.title }}" |
| 18 | + {% for k, v in tool.custom_attrs.items %} |
| 19 | + {{ k }}="{{ v }}" |
| 20 | + {% endfor %} |
| 21 | + class="{{ tool.standard_attrs.class }}"> |
| 22 | + {{ tool.label|capfirst }} |
| 23 | + </a> |
| 24 | + </form> |
| 25 | + </li> |
| 26 | + {% endif %} |
19 | 27 | {% endfor %}
|
20 | 28 | {{ block.super }}
|
21 | 29 | {% endblock %}
|
| 30 | + |
| 31 | +{% block object-tools %} |
| 32 | + {{ block.super }} |
| 33 | + {% for tool in objectactions %} |
| 34 | + {% if tool.form %} |
| 35 | + {% url tools_view_name pk=object_id tool=tool.name as action_url %} |
| 36 | + <div class="clear"> |
| 37 | + <form name="{{ tool.name }}__form" method="post" action="{% add_preserved_filters action_url %}"> |
| 38 | + {% csrf_token %} |
| 39 | + <ul class="object-tools django-object-actions"> |
| 40 | + {{ tool.form.as_ul }} |
| 41 | + <li class="objectaction-item" data-tool-name="{{ tool.name }}"> |
| 42 | + <a href="javascript:window.document.forms['{{ tool.name }}__form'].submit()" title="{{ tool.standard_attrs.title }}" |
| 43 | + {% for k, v in tool.custom_attrs.items %} |
| 44 | + {{ k }}="{{ v }}" |
| 45 | + {% endfor %} |
| 46 | + class="{{ tool.standard_attrs.class }}"> |
| 47 | + {{ tool.label|capfirst }} |
| 48 | + </a> |
| 49 | + </li> |
| 50 | + </ul> |
| 51 | + </form> |
| 52 | + </div> |
| 53 | + {% endif %} |
| 54 | + {% endfor %} |
| 55 | + <div class="clear"></div> |
| 56 | +{% endblock %} |
0 commit comments