Adrian Holovaty wrote: > I love the idea of a Paginator class that knows what page it's on. Maybe a solution is to get a 'page' object back from the original paginator. So you can still call its methods to get individual morsels of data, or call a get_page_info method to get a PageInfo object back with all its bits in place. Then the paginator doesn't have to be page aware.
> > 5. Orphans - see Chris' ticket. > I'm not 100% sold on this, but I'll give it some more thought... I've only ever needed this once, when the paginator was paginating (sic?) the sections of a report. In normal lists I don't mind orphans, but if the facility was there, I think I'd probably use it, because I rarely _need_ exactly n items on a page. > The problem with QuerySets implementing __len__ is that sometimes you > care about the length of the QuerySet *after* the query has been done, > and sometimes you care about the number of records (i.e., *before* the > query has been done). Couldn't __len__ then do likewise: if the query hasn't been dispatched it runs a count query, if it has it runs len on the result set. > I like this suggestion for the paginator, though. What about one of > these solutions: > > * Try .count() first. If the method doesn't exist, use len(). Exactly what I was thinking. A relatively minimal change, and very useful. > * Pass an optional count_method to the constructor, which defaults to > 'count', but people could pass in '__len__' if they wanted. This is > slightly less elegant than the previous solution. Personally doesn't float my boat, but still very usable. >> 7. You should be able to get a whole dictionary of data ... > I think this wouldn't be necessary if we had a PaginatorPage (as > suggested in #2576), because, in theory, the PaginatorPage would have > access to all the stuff you needed in your template. Am I missing > something? No, that's right. To me this is the absolute biggest thing. When I want to render a page, I want an object accessible through template methods only (so no tedious processing in the view) that can give me everything I need to render the links to give context and to navigate through pages in the list. Ideally this would be an object (like PaginatorPage), otherwise a dictionary would do. Ian. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@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-users -~----------~----~----~----~------~----~------~--~---