Answer the question
In order to leave comments, you need to log in
Why doesn't pagination work in Django (no DB)?
Hello, such a thing: the documentation says: "Note that you can give Paginator a list/tuple, a Django QuerySet, or any other object with a count() or __len__() method"
In docks, the list of objects is created from the database
def listing(request):
contact_list = Contacts.objects.all()
paginator = Paginator(contact_list, 25) # Show 25 contacts per page
page = request.GET.get('page')
contacts = paginator.get_page(page)
return render(request, 'list.html', {'contacts': contacts})
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question