Research
Security News
Malicious npm Package Targets Solana Developers and Hijacks Funds
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
django-pagination-py3
Advanced tools
A port of ericflo/django-pagination to Python 3. Updated to be compatible with Django 4.x and 5.0.
For versions compatible with Django 3.x and Python 2.7+ please install or download version 1.2.0
from Releases or
Pypi.
Install using pip
command:
pip install django-pagination-py3
...or clone the repo and install it using pip
:
git clone git://github.com/matagus/django-pagination-py3.git
cd django-pagination-py3
pip install -e .
Add pagination
INSTALLED_APPS to your settings.py
:
INSTALLED_APPS = (
# ...
"pagination",
)
Add the middleware:
MIDDLEWARE_CLASSES = (
# ...
'pagination.middleware.PaginationMiddleware',
)
Add this line at the top of your template to load the pagination tags:
{% load pagination_tags %}
Decide on a variable that you would like to paginate, and use the autopaginate tag on that variable before iterating
over it. This could take one of two forms (using the canonical object_list
as an example variable):
{% autopaginate object_list %}
This assumes that you would like to have the default 20 results per page. If you would like to specify your own amount of results per page, you can specify that like so:
{% autopaginate object_list 10 %}
Note that this replaces object_list
with the list for the current page, so you can iterate over the object_list
like you normally would.
Now you want to display the current page and the available pages, so somewhere after having used autopaginate, use the paginate inclusion tag:
{% paginate %}
This does not take any arguments, but does assume that you have already called autopaginate, so make sure to do so first.
That's it! You have now paginated object_list
and given users of the site a way to navigate between the different
pages--all without touching your views.
hatch run test:test
will run the tests in every Python + Django versions combination.
hatch run test.py3.12-5.0:test
: will run them for python 3.12 and Django 5.0. Please see possible combinations using
hatch env show
("test" matrix).
django-pagination-py3
is released under an BSD License - see the LICENSE
file for more information.
Posts I learned from:
FAQs
A port of ericflo/django-pagination to Python 3 and beyond!
We found that django-pagination-py3 demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.