{% load django_tables2 %}

{# Custom pagination controls to render nicely with Bootstrap CSS. smart_pages requires EnhancedPaginator. #}

<div class="row">
    <div class="col-md-7">
    {% if table.paginator.num_pages > 1 %}
        <nav>
            <ul class="pagination">
                {% if table.page.has_previous %}
                    <li><a href="{% querystring table.prefixed_page_field=table.page.previous_page_number %}">&laquo;</a></li>
                {% endif %}
                {% for p in table.page.smart_pages %}
                    {% if p %}
                        <li{% ifequal table.page.number p %} class="active"{% endifequal %}><a href="{% querystring table.prefixed_page_field=p %}">{{ p }}</a></li>
                    {% else %}
                        <li class="disabled"><span>&hellip;</span></li>
                    {% endif %}
                {% endfor %}
                {% if table.page.has_next %}
                    <li><a href="{% querystring table.prefixed_page_field=table.page.next_page_number %}">&raquo;</a></li>
                {% endif %}
            </ul>
        </nav>
    {% endif %}
    </div>
    <div class="col-md-5 text-right text-muted">
        Showing {{ table.page.start_index }}-{{ table.page.end_index }} of {{ total }}
        {% if total == 1 %}
            {{ table.data.verbose_name }}
        {% else %}
            {{ table.data.verbose_name_plural }}
        {% endif %}
    </div>
</div>