Simply from django.core.paginator import Paginatorcreate a paginator object as p = Paginator(thestuff, 7)in the home page view p = Paginator(thestuff, 10)everywhere. Then, in any case, link pin the context that you use to render the template. p.object_listwill be set appropriately anyway (and you seem to be saying that the approach you are using is correct? Ie, what do you mean by "Django object_list"?).
Django docs have great details and examples (if you're at 1.0 or better). If you can't make it work, can you show us (the simplified version that still fails) your template and view the code?
: , , Django :
from django.core.paginator import Paginator, Page
class MyPaginator(Paginator):
def __init__(self, **kw):
self.deltafirst = kw.pop('deltafirst', 0)
Paginator.__init__(self, **kw)
def page(self, number):
"Returns a Page object for the given 1-based page number."
number = self.validate_number(number)
if number == 1:
bottom = 0
top = self.per_page - self.deltafirst
else:
bottom = (number - 1) * self.per_page - self.deltafirst
top = bottom + self.per_page
if top + self.orphans >= self.count:
top = self.count
return Page(self.object_list[bottom:top], number, self)
MyPaginator , , Django own, , deltafirst=3, 3 ( 10). , paginator 10, deltafirst 3, 3 .
( validate_number , , - , MyPaginator ).