Skip to content

Commit 2b5e20b

Browse files
committed
fix pagination
1 parent 8a1fad6 commit 2b5e20b

File tree

3 files changed

+72
-74
lines changed

3 files changed

+72
-74
lines changed

adminlteui/templates/admin/change_list.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ <h4 class="box-title">
7878
</div>
7979

8080
<form id="changelist-form" method="post"{% if cl.formset and cl.formset.is_multipart %} enctype="multipart/form-data"{% endif %} novalidate>{% csrf_token %}
81+
<div class="dataTables_wrapper form-inline dt-bootstrap">
8182
{% if cl.formset %}
8283
<div>{{ cl.formset.management_form }}</div>
8384
{% endif %}
@@ -88,6 +89,7 @@ <h4 class="box-title">
8889
{% if action_form and actions_on_bottom and cl.show_admin_actions %}{% admin_actions %}{% endif %}
8990
{% endblock %}
9091
{% block pagination %}{% pagination cl %}{% endblock %}
92+
</div>
9193
</form>
9294
</div>
9395
</div>

adminlteui/templates/admin/change_list_results.html

Lines changed: 33 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -6,46 +6,40 @@
66
{% endif %}
77
{% if results %}
88

9-
<div class="dataTables_wrapper form-inline dt-bootstrap">
10-
<div class="row">
11-
<div class="col-sm-6"></div>
12-
<div class="col-sm-6"></div>
13-
</div>
14-
<div class="row">
15-
<div class="col-sm-12">
16-
<table id="example2" class="table table-bordered table-hover dataTable" role="grid" aria-describedby="example2_info">
17-
<thead>
18-
<tr role="row">
19-
{% for header in result_headers %}
20-
<th {% if header.sortable %}
21-
{% if header.sorted %}
22-
{% if header.ascending %}
23-
class="sorting_asc"
24-
{% else %}
25-
class="sorting_desc"
26-
{% endif %}
27-
{% else %}
28-
class="sorting"
29-
{% endif %}
30-
{% endif %}
31-
{% if forloop.counter0 == 0 %}
32-
class="djn-checkbox-select-all"
33-
{% endif %}
34-
tabindex="0" aria-controls="example2" rowspan="1" colspan="1" aria-label="Rendering engine: activate to sort column descending"><div class="text">{% if header.sortable %}<a href="{{ header.url_primary }}">
35-
{{ header.text|capfirst }}</a>{% else %}<span>{{ header.text|capfirst }}</span>{% endif %} {% if header.sorted %}<a href="{{ header.url_remove }}"><div style="margin-top: .2em;" class="fa fa-close pull-right"></div></a>{% endif %}</div>
36-
</th>
37-
{% endfor %}
38-
</tr>
39-
</thead>
40-
<tbody>
41-
{% for result in results %}
42-
<tr role="row" class="{% cycle 'even' 'odd' %}">
43-
{% for item in result %}{{ item }}{% endfor %}
44-
</tr>
9+
<div class="row">
10+
<div class="col-sm-12">
11+
<table id="example2" class="table table-bordered table-hover dataTable" role="grid" aria-describedby="example2_info">
12+
<thead>
13+
<tr role="row">
14+
{% for header in result_headers %}
15+
<th {% if header.sortable %}
16+
{% if header.sorted %}
17+
{% if header.ascending %}
18+
class="sorting_asc"
19+
{% else %}
20+
class="sorting_desc"
21+
{% endif %}
22+
{% else %}
23+
class="sorting"
24+
{% endif %}
25+
{% endif %}
26+
{% if forloop.counter0 == 0 %}
27+
class="djn-checkbox-select-all"
28+
{% endif %}
29+
tabindex="0" aria-controls="example2" rowspan="1" colspan="1" aria-label="Rendering engine: activate to sort column descending"><div class="text">{% if header.sortable %}<a href="{{ header.url_primary }}">
30+
{{ header.text|capfirst }}</a>{% else %}<span>{{ header.text|capfirst }}</span>{% endif %} {% if header.sorted %}<a href="{{ header.url_remove }}"><div style="margin-top: .2em;" class="fa fa-close pull-right"></div></a>{% endif %}</div>
31+
</th>
4532
{% endfor %}
46-
</tbody>
47-
</table>
48-
</div>
33+
</tr>
34+
</thead>
35+
<tbody>
36+
{% for result in results %}
37+
<tr role="row" class="{% cycle 'even' 'odd' %}">
38+
{% for item in result %}{{ item }}{% endfor %}
39+
</tr>
40+
{% endfor %}
41+
</tbody>
42+
</table>
4943
</div>
5044
</div>
5145
{% endif %}
Lines changed: 37 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,44 @@
11
{% load admin_list adminlte_list %}
22
{% load i18n %}
33

4-
<div class="col-sm-5">
5-
<div class="dataTables_info" id="example2_info" role="status" aria-live="polite">
6-
{{ cl.result_count }}
7-
{% if cl.result_count == 1 %}
8-
{{ cl.opts.verbose_name }}
9-
{% else %}
10-
{{ cl.opts.verbose_name_plural }}
11-
{% endif %}
4+
<div class="row">
5+
<div class="col-sm-5">
6+
<div class="dataTables_info" id="example2_info" role="status" aria-live="polite">
7+
{{ cl.result_count }}
8+
{% if cl.result_count == 1 %}
9+
{{ cl.opts.verbose_name }}
10+
{% else %}
11+
{{ cl.opts.verbose_name_plural }}
12+
{% endif %}
1213

13-
{% if show_all_url %}&nbsp;&nbsp;<a href="{{ show_all_url }}"
14-
class="showall">{% trans 'Show all' %}</a>{% endif %}
15-
{% if cl.formset and cl.result_count %}<input type="submit" name="_save"
16-
class="btn btn-primary"
17-
value="{% trans 'Save' %}">{% endif %}
14+
{% if show_all_url %}&nbsp;&nbsp;<a href="{{ show_all_url }}"
15+
class="showall">{% trans 'Show all' %}</a>{% endif %}
16+
{% if cl.formset and cl.result_count %}<input type="submit" name="_save"
17+
class="btn btn-primary"
18+
value="{% trans 'Save' %}">{% endif %}
19+
</div>
1820
</div>
19-
</div>
2021

21-
<div class="col-sm-7">
22-
<div class="dataTables_paginate paging_simple_numbers"
23-
id="example2_paginate">
24-
<ul class="pagination">
25-
{% if pagination_required %}
26-
<li class="paginate_button previous disabled"
27-
id="example2_previous">
28-
<a href="#" aria-controls="example2" data-dt-idx="0"
29-
tabindex="0">{% trans 'Previous' %}</a></li>
30-
{% for i in page_range %}
31-
{% adminlte_paginator_number cl i %}
32-
{% endfor %}
33-
<li class="paginate_button next disabled" id="example2_next">
34-
<a href="#"
35-
aria-controls="example2"
36-
data-dt-idx="7"
37-
tabindex="0">{% trans 'Next' %}</a>
38-
</li>
39-
{% endif %}
40-
</ul>
22+
<div class="col-sm-7">
23+
<div class="dataTables_paginate paging_simple_numbers"
24+
id="example2_paginate">
25+
<ul class="pagination">
26+
{% if pagination_required %}
27+
<li class="paginate_button previous disabled"
28+
id="example2_previous">
29+
<a href="#" aria-controls="example2" data-dt-idx="0"
30+
tabindex="0">{% trans 'Previous' %}</a></li>
31+
{% for i in page_range %}
32+
{% adminlte_paginator_number cl i %}
33+
{% endfor %}
34+
<li class="paginate_button next disabled" id="example2_next">
35+
<a href="#"
36+
aria-controls="example2"
37+
data-dt-idx="7"
38+
tabindex="0">{% trans 'Next' %}</a>
39+
</li>
40+
{% endif %}
41+
</ul>
42+
</div>
4143
</div>
42-
</div>
44+
</div>

0 commit comments

Comments
 (0)