This is a pre-production deployment of Warehouse, however changes made here WILL affect the production instance of PyPI.
Latest Version Dependencies status unknown Test status unknown Test coverage unknown
Project Description

Generate pagination links for Django

Instead of displaying links to all the pages at once, django-smart-pagination calculates a limited subset of them.

Works with Django Templates and Jinja2.

Usage

First add smart_pagination to your installed apps:

INSTALLED_APPS = [
    'smart_pagination'
]

Use a pagination block passing the Page object, the number of links (literal of variable) and the name to associate the smart_pagination.Paginator object.

{% load pagination_tags %}
{% paginate page_obj num_links paging %}
<ul>
    {% for page in paging.pages %}
    <li class="{% if page.is_current %}current{% endif %}">{{ page.number }}</li>
    {% endfor %}
</ul>
{% endpaginate %}

The Paginator object contains the following properties:

first First Page. Will be None if it is already the first page.
prev Previous Page. Will be None if there is no previous page.
pages List of pages.
next Next Page. Will be None if there is no next page.
last Last Page. Will be None if it is already the last page.
{% load pagination_tags %}
{% paginate page_obj num_links paging %}
<ul>
    {% if paging.first %}
    <li>First - {{ paging.first.number }}</li>
    {% endif %}

    {% if paging.prev %}
    <li>Previous - {{ paging.prev.number }}</li>
    {% endif %}

    {% for page in paging.pages %}
    <li class="{% if page.is_current %}current{% endif %}">{{ page.number }}</li>
    {% endfor %}

    {% if paging.next %}
    <li>Next - {{ paging.next.number }}</li>
    {% endif %}

    {% if paging.last %}
    <li>Last - {{ paging.last.number }}</li>
    {% endif %}
</ul>
{% endpaginate %}

If you are sending the page_kwarg as a query parameter, you can optionally pass a fourth argument with the name of the page_kwarg and the Paginator will provide the query string without the page_kwarg:

{% load pagination_tags %}
{% paginate page_obj num_links paging 'page' %}
<ul>
    {% for page in paging.pages %}
    <li><a href="?page={{ page.number }}&{{ paging.query }}">{{ page.number }}</a></li>
    {% endfor %}
</ul>
{% endpaginate %}
Release History

Release History

1.0.1

This version

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

1.0.0

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

Download Files

Download Files

TODO: Brief introduction on what you do with files - including link to relevant help section.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
django_smart_pagination-1.0.1-py2.py3-none-any.whl (7.6 kB) Copy SHA256 Checksum SHA256 py2.py3 Wheel Oct 8, 2015
django-smart-pagination-1.0.1.tar.gz (5.4 kB) Copy SHA256 Checksum SHA256 Source Oct 8, 2015

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS HPE HPE Development Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting