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” %}
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” %}
Release files for django-nextpage 2.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| django_nextpage-2.1.0.tar.gz | 5.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| django_nextpage-2.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 10.7 kB
Release files / django_nextpage-2.1.0.tar.gz
| Download URL | django_nextpage-2.1.0.tar.gz |
|---|---|
| Size | 5.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
45a8beb61e24c77d8fd8664ccb5a57587bbb63f10aa3ece4515af5f95a5fa8be
|
|
BLAKE2b-256 checksum How to use checksums |
5a3fbf70d9fe8b0d1328871ca4ce529dbcb6cc614d2bada20e5091c906d48e3d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.8.18
|
Release files / django_nextpage-2.1.0-py3-none-any.whl
| Download URL | django_nextpage-2.1.0-py3-none-any.whl |
|---|---|
| Size | 5.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
81f54dee432e6f1c508b841ddd217e23a967cb78a50221c61056229b24880e27
|
|
BLAKE2b-256 checksum How to use checksums |
5d26c826977494b7ad5906cf3dd324c43ffe02f80f993733a9f01c6392c15045
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.8.18
|