Security News
Weekly Downloads Now Available in npm Package Search Results
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
django-cool-pagination
Advanced tools
django-cool-pagination is simple pagination app that saves your time.
The project is still on development stage, some things may not work properly.
Currently it supports Bootstrap 4.x only. So that you have to add Bootstrap4 to your project.
pip install django-cool-pagination
git clone https://github.com/joe513/django-cool-pagination.git
cd django-cool-pagination
python setup.py install
INSTALLED_APPS
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'django_cool_paginator'
request
is in context_processors
'context_processors': [
'django.template.context_processors.debug',
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
def listing(request):
contact_list = Contacts.objects.all()
paginator = Paginator(contact_list, 25)
page = request.GET.get('page')
page_obj = paginator.get_page(page)
return render(request, 'list.html', {'page_obj': page_obj})
class Listing(ListView):
model = Item
paginate_by = 5
{% load cool_paginate %}
{% for contact in page_obj %}
...
{% endfor %}
{% cool_paginate page_obj=ENTER HERE YOUR PAGE OBJECT! %}
Note: You don't have to specify
page
if its name ispage_obj
as default.
You can customize it so that it works as you want. Customize it by defining settings either in setting.py or
inside of {% cool_paginate %}
COOL_PAGINATOR_NEXT_NAME
- Name for "next" button in pagination bar.
COOL_PAGINATOR_PREVIOUS_NAME
- Name for "previous" button in pagination bar
COOL_PAGINATOR_SIZE
- Size of pagination bar (choose: "LARGE" or "SMALL")
COOL_PAGINATOR_ELASTIC
- What page width is elastic mode enabled from?
page_obj
- Type here your page object.
next_name
- Name for "next" button in pagination bar.
previous_name
- Name for "previous" button in pagination bar
size
- Size of pagination bar (choose: "LARGE" or "SMALL")
elastic
- What page width is elastic mode enabled from?
Note:
{% cool_paginate %}
has a priority, django-cool-pagination will firstly look at this, after at setting.py
This project is licensed under the MIT License - see the LICENSE file for details
inspired by inoks/m3u8
FAQs
Simple pagination app that saves your time.
We found that django-cool-pagination 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.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
Security News
A Stanford study reveals 9.5% of engineers contribute almost nothing, costing tech $90B annually, with remote work fueling the rise of "ghost engineers."
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.