Skip to content

Instantly share code, notes, and snippets.

@cspanring
Created November 8, 2011 02:53
Show Gist options
  • Save cspanring/1346879 to your computer and use it in GitHub Desktop.
Save cspanring/1346879 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 %}
@nskeip
Copy link

nskeip commented May 29, 2012

nice! thankx!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment