{% extends 'django_tables2/bootstrap.html' %} {% load django_tables2 %} {% block table-wrapper %}
{% block table %} {{ block.super }} {% endblock table %} {% if table.page and table.paginator.num_pages > 1 %} {% with current_page=table.page.number page_count=table.paginator.num_pages rows_per_page=table.page.object_list|length total_rows=table.page.paginator.count %} {% block pagination %}
    {% block pagination.allpages %}
  • Page
  • {% for page in table.paginator.page_range %} {% with range_start=current_page|add:"-3" range_end=current_page|add:"3" page_count_minus_5=page_count|add:"-5" page_count_minus_1=page_count|add:"-1" %} {% if page == current_page %}
  • {{ page }}
  • {% elif page == 1 or page >= range_start and page <= range_end or page == page_count %} {% endif %} {% if page == 1 and current_page > 5 or pagina == page_count_minus_1 and current_page <= page_count_minus_5 %}
  • ...
  • {% endif %} {% endwith %} {% endfor %} {% endblock pagination.allpages %}
{% block pagination.cardinality %}
{% if total_rows != rows_per_page %} {{ rows_per_page }} of {{ total_rows }} {% else %} {{ total_rows }} {% endif %} {% if total_rows == 1 %} {{ table.data.verbose_name }} {% else %} {{ table.data.verbose_name_plural }} {% endif %}
{% endblock pagination.cardinality %}
{% endblock pagination %} {% endwith %} {% endif %}
{% endblock table-wrapper %}