Reputation: 11152
I just read the doc about Django pagination.
From the example, it seems to need to be used like this:
Now, let's say I wan't to use pagination with a very long query that returns 100000 entries. I takes a very long time to load all 100000 objects at once.
What I'd like to do is to load only 10 objects per page. Is there a way to do this using Django paginator, and maybe some limit/offset queries?
Thanks.
Upvotes: 3
Views: 744
Reputation: 45565
No, Paginator doesn't load all objects to memory. If you pass a queryset to Paginator then it uses .count()
to get number of objects.
Upvotes: 4