Skip to main content

django-nextpage

Project description

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:

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

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

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” %}

Bitdeli badge

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django_nextpage-2.0.0.tar.gz (5.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

django_nextpage-2.0.0-py3-none-any.whl (5.4 kB view details)

Uploaded Python 3

File details

Details for the file django_nextpage-2.0.0.tar.gz.

File metadata

  • Download URL: django_nextpage-2.0.0.tar.gz
  • Upload date:
  • Size: 5.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.8.18

File hashes

Hashes for django_nextpage-2.0.0.tar.gz
Algorithm Hash digest
SHA256 f8796491add259d218844c98504359c5c212dd733261c054aec94c745921df50
MD5 de83a3cef8381b626215c0c6780b023c
BLAKE2b-256 574d241209d2d1412fad2cf4b8eed77f69e6f70c2ae5f19ddb18a006131af0e4

See more details on using hashes here.

File details

Details for the file django_nextpage-2.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for django_nextpage-2.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2eafca00939dc36a875dfd87f7a80fc6a7c04741fe8af6c781905ee8c3879b3e
MD5 a62d8237bdc29449f6c01874dcfdb035
BLAKE2b-256 ded26db5afd30aa9e9a368279f89aee6f79bd852263525feb8b81ecb70b63382

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page