Pagination

Pagination splits a long list of results into fixed-size pages to limit the amount of data loaded and displayed. Django provides Paginator and Page, and generic views accept paginate_by. The page number is usually passed in the ?page= URL parameter.

Example

paginator = Paginator(Post.objects.all(), 10)
page = paginator.get_page(request.GET.get('page'))

Related concepts

The whole glossary