from django.core.paginator import Paginator from myapp.models import MyModel # get all objects in queryset all_objects = MyModel.objects.all() # create a paginator object with page size of 10 paginator = Paginator(all_objects, 10) # get the current page number (assuming it's passed in as a query parameter) page_number = request.GET.get('page', 1) # get the current page object page = paginator.get_page(page_number) # check if there is a previous page available has_previous = page.has_previous()In this example, we create a paginator object with a page size of 10, and get the current page number from the request query parameters. We then use the paginator object to get the current page object, and use the has_previous method to check if there is a previous page available. Package library: django.core.paginator is a part of the Django framework.