Skip to content

Instantly share code, notes, and snippets.

@nskeip
Forked from cspanring/pagination.html
Created May 29, 2012 10:53
Show Gist options
  • Save nskeip/2826622 to your computer and use it in GitHub Desktop.
Save nskeip/2826622 to your computer and use it in GitHub Desktop.
linaro django pagination template for Bootstrap framework
{# use in combination with https://github.com/zyga/django-pagination #}
{# and http://twitter.github.com/bootstrap/ #}
{# project-dir/templates/pagination/pagination.html #}
{% if is_paginated %}
{% load i18n %}
<div class="pagination">
<ul>
{% block previouslink %}
{% if page_obj.has_previous %}
<li class="prev"><a href="?page{{ page_suffix }}={{ page_obj.previous_page_number }}{{ getvars }}">{{ previous_link_decorator|safe }}{% trans "Previous" %}</a></li>
{% else %}
{% if display_disabled_previous_link %}
<li class="prev disabled"><a>{{ previous_link_decorator|safe }}{% trans "Previous" %}</a></li>
{% endif %}
{% endif %}
{% endblock previouslink %}
{% block pagelinks %}
{% if display_page_links %}
{% for page in pages %}
{% if page %}
{% ifequal page page_obj.number %}
<li class="active"><a href="#">{{ page }}</a></li>
{% else %}
<li><a href="?page{{ page_suffix }}={{ page }}{{ getvars }}">{{ page }}</a></li>
{% endifequal %}
{% else %}
...
{% endif %}
{% endfor %}
{% endif %}
{% endblock pagelinks %}
{% block nextlink %}
{% if page_obj.has_next %}
<li class="next"><a href="?page{{ page_suffix }}={{ page_obj.next_page_number }}{{ getvars }}">{% trans "Next" %}{{ next_link_decorator|safe }}</a></li>
{% else %}
{% if display_disabled_next_link %}
<li class="next disabled"><a>{% trans "Next" %}{{ next_link_decorator|safe }}</a></li>
{% endif %}
{% endif %}
{% endblock nextlink %}
</ul>
</div>
{% endif %}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment