Login

Pagination Django with Boostrap

Author:
guilegarcia
Posted:
October 11, 2015
Language:
HTML/template
Version:
Not specified
Score:
0 (after 0 ratings)

Create a list of pages using Django 1.8 and marks the current page. Using Bootstrap. * "list_itens" is a list of itens paginated.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
{% if num_pages %}
                <ul class="pagination">
                {% for num in num_pages %}
                    {% if num == list_itens.number %}
                        <li class="active"><a href="?page={{ num }}">{{ num }}</a></li>
                    {% else %}
                        <li><a href="?page={{ num }}">{{ num }}</a></li>
                    {% endif %}
                {% endfor  num_pages %}
                </ul>
            {% endif %}

More like this

  1. Bootstrap Accordian by Netplay4 5 years, 10 months ago
  2. Bootstrap theme for django-endless-pagination? by se210 8 years, 10 months ago
  3. Bootstrap theme for django-endless-pagination? by se210 8 years, 10 months ago
  4. Reusable form template with generic view by roldandvg 8 years, 11 months ago
  5. django form template with bootstrap by youyongsong 9 years, 10 months ago

Comments

Please login first before commenting.