Answer the question
In order to leave comments, you need to log in
Why does django have such weird pagination?
Hello! I recently started learning django and came across a very strange thing when using pagination (this is after a dozen years of working with PHP).
The documentation has an example:
contact_list = Contact.objects.all() # Получить ВСЕ(!!!) записи???
paginator = Paginator(contact_list, 25) # Разделить список на чанки/страницы
Answer the question
In order to leave comments, you need to log in
The Queryset is lazy, no fetching occurs unless the contact_list is iterated in some way. The paginator under the hood will simply add the parameters for selecting the desired page to the uncomputed queryset and pass it to the context of the template engine.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question