|
18 | 18 | {% endif %} |
19 | 19 | {% endblock %} |
20 | 20 |
|
| 21 | +{% block custom_style %} |
| 22 | +<link rel="stylesheet" href="{% static "admin/plugins/datatables/dataTables.bootstrap.css" %}"> |
| 23 | +{% endblock %} |
| 24 | + |
21 | 25 | {% block extrahead %} |
22 | 26 | {{ block.super }} |
23 | 27 | {{ media.js }} |
|
39 | 43 |
|
40 | 44 | {% block content %} |
41 | 45 | <div id="content-main"> |
42 | | - {% block object-tools %} |
43 | | - <ul class="object-tools"> |
44 | | - {% block object-tools-items %} |
45 | | - {% change_list_object_tools %} |
46 | | - {% endblock %} |
47 | | - </ul> |
48 | | - {% endblock %} |
49 | 46 | {% if cl.formset and cl.formset.errors %} |
50 | 47 | <p class="errornote"> |
51 | 48 | {% if cl.formset.total_error_count == 1 %}{% trans "Please correct the error below." %}{% else %}{% trans "Please correct the errors below." %}{% endif %} |
|
54 | 51 | {% endif %} |
55 | 52 | <div class="module{% if cl.has_filters %} filtered{% endif %}" id="changelist"> |
56 | 53 | <div class="row"> |
57 | | - {% block date_hierarchy %}{% if cl.date_hierarchy %}{% date_hierarchy cl %}{% endif %}{% endblock %} |
| 54 | + {% block date_hierarchy %}{% if cl.date_hierarchy %}{% date_hierarchy cl %}{% endif %}{% endblock %} |
| 55 | + |
| 56 | + {% block search %}{% search_form cl %}{% endblock %} |
58 | 57 |
|
59 | | - {% block search %}{% search_form cl %}{% endblock %} |
| 58 | + </div> |
60 | 59 |
|
| 60 | + {% block object-tools %} |
| 61 | + <div class="row"> |
| 62 | + {% block object-tools-items %} |
| 63 | + {% change_list_object_tools %} |
| 64 | + {% endblock %} |
61 | 65 | </div> |
| 66 | + {% endblock %} |
62 | 67 |
|
63 | 68 | <form id="changelist-form" method="post"{% if cl.formset and cl.formset.is_multipart %} enctype="multipart/form-data"{% endif %} novalidate>{% csrf_token %} |
64 | 69 | {% if cl.formset %} |
|
77 | 82 | {% endblock %} |
78 | 83 |
|
79 | 84 | {% block custom_js %} |
| 85 | +<script src="{% static "admin/plugins/datatables/jquery.dataTables.min.js" %}"></script> |
| 86 | +<script src="{% static "admin/plugins/datatables/dataTables.bootstrap.min.js" %}"></script> |
80 | 87 |
|
81 | 88 | <script> |
82 | 89 | var selectors = document.querySelector('#changelist-search').querySelectorAll('select'); |
|
85 | 92 | var $field = $(this); |
86 | 93 | var $option = $field.find('option:selected'); |
87 | 94 | var select_name = $option.data('name'); |
88 | | - console.log(select_name); |
89 | 95 | if (select_name) { |
90 | 96 | $field.attr('name', select_name); |
91 | 97 | } else { |
|
105 | 111 | // } |
106 | 112 |
|
107 | 113 | // remove the hidden input of select_name |
108 | | - var input = document.querySelector('#search_group').querySelector('input[name="' + select_name + '"]'); |
| 114 | + var input = document.querySelector('#search_group').querySelector('input[name="' + $field.data('name') + '"]'); |
109 | 115 | input.parentNode.removeChild(input) |
110 | 116 | } |
111 | 117 | } |
|
0 commit comments