from django.core.paginator import Paginator items_per_page = 10 paginator = Paginator(queryset, items_per_page)
page_number = request.GET.get('page') page = paginator.get_page(page_number)
total_pages = paginator.num_pages
total_items = paginator.countIn the above examples, we are using the Django core.paginator that is a part of Django's core functionality. No additional package libraries are required. The methods and classes provided by this library can easily be used in any Django project to add pagination functionality.