On Jul 9, 1:11 pm, "Adrian Holovaty" <[EMAIL PROTECTED]> wrote: > On 7/8/07, Nick <[EMAIL PROTECTED]> wrote: > > > Ticket 4805 (http://code.djangoproject.com/ticket/4805) suggests > > adding a paginator object to the template context in the object_list > > generic view, which I think has its merits. > > > SmileyChris has a possible implementation in ticket 2576 (http:// > > code.djangoproject.com/ticket/2576) but was marked wontfix so I > > thought I'd bring the discussion here. > > > I can see the reasoning behind the wontfix, but I think in this light > > it might be worth reviewing. > > I'm a fan of the paginator-class-with-page-state idea from ticket > 2576, which is to say I disagree with the "wontfix." :-) > > I completely agree that it makes things much simpler, especially for > generic views. In that case, we can simply pass a single PaginatorPage > (or some better name) object to the template, rather than having to > pass "page_number" and "has_next_page" and "has_previous_page" and all > that assorted malarkey.
There are a couple of patches attached to #4805 to look at. One modifying the ObjectPaginator class to add an optional page argument, and one to add a new ObjectPaginator derived class based on #2576. Another issue to consider is whether to use zero or 1-based indexing for the page numbers. >From a coding POV it should be 0-based, but from a template POV it should probably be 1-based. The patch I added based on SmileyChris' work uses 0-based to create the paginator, and 1-based to access the page_number, next/previous_page_number properties (by default, customizable using the base argument). I can't decide if it should just stick to one or the other or not. Any thoughts? Cheers, Nick --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django developers" group. To post to this group, send email to django-developers@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-developers?hl=en -~----------~----~----~----~------~----~------~--~---