Overview

django-smartpaginator

Django-smartpaginator provides an easy and smart pagination based on Djangos own pagination system. There are two main points to smartpagination:

  • Doing pagination should be easy and require as little code as possible. (Done!)
  • When paginating for example 101 objects with 10 objects per page, there should be ten pages, not eleven. (Not done yet.)

NB! This project has yet no real documentation nor tests, so you propably shouldn't use it.

Configuration

  1. Put smartpaginator into your INSTALLED_APPS
  2. Make sure that "django.core.context_processors.request" is in your TEMPLATE_CONTEXT_PROCESSORS (it's not there by default).
  3. Profit!11

Basic usage

In your views.py:

from smartpaginator import get_pagination

...

my_queryset = MyModel.objects.all() object_list = get_pagination(request, queryset)

In your template:

{% load smartpaginator %}

...

{% render_pagination request object_list %}

That's it! Very easy!