Browse Source

Fix paginator in dataset page

pull/10/head
Hironsan 6 years ago
parent
commit
da0772c785
2 changed files with 31 additions and 3 deletions
  1. BIN
      app/db.sqlite3
  2. 34
      app/server/templates/admin/dataset.html

BIN
app/db.sqlite3

34
app/server/templates/admin/dataset.html

@ -23,7 +23,7 @@
<tbody>
{% for doc in object_list %}
<tr>
<td>{{ forloop.counter }}</td>
<td>{{ forloop.counter0|add:page_obj.start_index }}</td>
<td>{{ doc.text|truncatechars:200 }}</td>
</tr>
{% endfor %}
@ -33,19 +33,47 @@
</div>
{% if is_paginated %}
<nav class="pagination is-right" role="navigation" aria-label="pagination">
<nav class="pagination is-left" role="navigation" aria-label="pagination">
<ul class="pagination-list">
{% if page_obj.number == 1 %}
<li class="pagination-link" disabled><span></span></li>
{% else %}
<li>
<a class="pagination-link" href="?page=1"></a>
</li>
{% endif %}
{% if page_obj.has_previous %}
<li>
<a class="pagination-link" href="?page={{ page_obj.previous_page_number }}">&laquo;</a>
</li>
{% else %}
<li class="pagination-link" disabled><span>&laquo;</span></li>
{% endif %}
{% for i in paginator.page_range %}
{% if page_obj.number == i %}
<li>
<a class="pagination-link is-current" aria-label="Goto page {{ i }}">{{ i }}</a>
</li>
{% else %}
{% elif i > page_obj.number|add:'-5' and i < page_obj.number|add:'5' %}
<li>
<a href="?page={{ i }}" class="pagination-link" aria-label="Goto page {{ i }}">{{ i }}</a>
</li>
{% endif %}
{% endfor %}
{% if page_obj.has_next %}
<li>
<a class="pagination-link" href="?page={{ page_obj.next_page_number }}">&raquo;</a>
</li>
{% else %}
<li class="pagination-link" disabled><span>&raquo;</span></li>
{% endif %}
{% if page_obj.number == paginator.num_pages %}
<li class="pagination-link" disabled><span></span></li>
{% else %}
<li>
<a class="pagination-link" href="?page={{ paginator.num_pages }}"></a>
</li>
{% endif %}
</ul>
</nav>
{% endif %}
Loading…
Cancel
Save