Metadata-Version: 2.1
Name: django-nextpage
Version: 2.1.0
Summary: django-nextpage
Home-page: http://github.com/StreetVoice/django-nextpage
Author: tzangms
Author-email: tzangms@gmail.com
License: BSD
Keywords: pagination,django
Classifier: Programming Language :: Python
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Framework :: Django
Classifier: Framework :: Django :: 2.0
Classifier: Environment :: Web Environment
License-File: LICENSE
Requires-Dist: django >=2.0

===============
Django NextPage
===============

``django-nextpage`` is modified from django-pagination, but only previous and next page is provided.

Since SQL COUNT statement on large table has poor performance, lots of website turns to show just next  and previous page link or button.


How it works?
=========================

``django-nextpage`` only execute one SQL statement, no count, no next page determine query.

For example:

If you want to pagiante by 20, django-nextpage will query for 21 items, if queryset length is 21, then we have next page; if queryset length is 20 or less, then we don't have next page. 


Installation
============

Requires Django 2.0 or later.

Add ``nextpage`` to ``INSTALLED_APPS``, like:

.. code:: python

    INSTALLED_APPS = (
       # ...
       'nextpage',
    )


and your ``TEMPLATES`` setting's ``context_processors`` should include ``django.template.context_processors.request``, like:

.. code:: python

    TEMPLATES = [
        {
            'BACKEND': 'django.template.backends.django.DjangoTemplates',
            'OPTIONS': {
                'context_processors': [
                    'django.contrib.auth.context_processors.auth',
                    'django.template.context_processors.debug',
                    'django.template.context_processors.i18n',
                    'django.template.context_processors.media',
                    'django.template.context_processors.request',
                ],
            },
        },
    ]



Usage
=====

Just like ``django-pagination``, in fact it designed as a drop-in replacement. just load ``nextpage`` templatetag 

    {% load nextpage %}

    {% autopaginate object_list 20 %}

    {% paginate %}

or you can assign with different pagination template in `templates/nextpage` folder by

    {% paginate "your_own_pagination.html" %}

or you can specify the path used to build the previous/next page urls, instead of using ``request.path``

    {% paginate path="/some/other/path/" %}

any extra keyword arguments passed to ``paginate`` are forwarded to the pagination template, so you can use them inside your own template

    {% paginate foo="bar" %}


.. image:: https://d2weczhvl823v0.cloudfront.net/StreetVoice/django-nextpage/trend.png
   :alt: Bitdeli badge
   :target: https://bitdeli.com/free

