the Paginator class doesn't slice self.object_list properly
|Reported by:||stefantalpalaru||Owned by:||nobody|
|Has patch:||yes||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
The Paginator class from django.core.paginator is supposed to splice self.object_list when creating the Page object (in the page() method) so only the items on that page are retrieved.
Due to a misunderstanding of the splice syntax, more items than needed are fetched:
return Page(self.object_list[bottom:top], number, self)
where top = bottom + self.per_page
The correct code is:
return Page(self.object_list[bottom:self.per_page], number, self)
and the lines where 'top' is computed and adjusted can be removed.