paginator.html 1.4 KB

1234567891011121314151617181920212223242526272829303132333435
  1. {% load django_tables2 %}
  2. {# Custom pagination controls to render nicely with Bootstrap CSS. smart_pages requires EnhancedPaginator. #}
  3. <div class="row">
  4. <div class="col-md-7">
  5. {% if table.paginator.num_pages > 1 %}
  6. <nav>
  7. <ul class="pagination">
  8. {% if table.page.has_previous %}
  9. <li><a href="{% querystring table.prefixed_page_field=table.page.previous_page_number %}">&laquo;</a></li>
  10. {% endif %}
  11. {% for p in table.page.smart_pages %}
  12. {% if p %}
  13. <li{% ifequal table.page.number p %} class="active"{% endifequal %}><a href="{% querystring table.prefixed_page_field=p %}">{{ p }}</a></li>
  14. {% else %}
  15. <li class="disabled"><span>&hellip;</span></li>
  16. {% endif %}
  17. {% endfor %}
  18. {% if table.page.has_next %}
  19. <li><a href="{% querystring table.prefixed_page_field=table.page.next_page_number %}">&raquo;</a></li>
  20. {% endif %}
  21. </ul>
  22. </nav>
  23. {% endif %}
  24. </div>
  25. <div class="col-md-5 text-right text-muted">
  26. Showing {{ table.page.start_index }}-{{ table.page.end_index }} of {{ total }}
  27. {% if total == 1 %}
  28. {{ table.data.verbose_name }}
  29. {% else %}
  30. {{ table.data.verbose_name_plural }}
  31. {% endif %}
  32. </div>
  33. </div>