On Wednesday, 12 September 2012 13:02:33 UTC+1, axel...@chaos1.de wrote: > > > Am 12.09.2012 um 10:27 schrieb Stephen Anto: > > > There are lots of sources available on net for Django pagination. I am > > using django pagination on my website http://www.f2finterview.com/ for > show > > questions and answers. > > > > each request fetches only five questions and answers (Eg. > > http://f2finterview.com/web/Django/) > Is this lazy fetching, i.e. are the rows fetched, when I step into that > page, or immediately? > I tried Subclassing Paginator and slicing: > --- > class OneShotPaginator(Paginator): > def __init__(self, object_list, per_page, orphans=0, > allow_empty_first_page=True): > super(OneShotPaginator, self).__init__(object_list[:20], per_page, > orphans, allow_empty_first_page) > --- > This did not reduce the number of displayed rows to 20. > Only the summary count at the botton is now 20. )-8 > Any glue? > > > > On Wed, Sep 12, 2012 at 1:44 PM, Axel Rau <axel...@chaos1.de<javascript:>> > wrote: > > > >> I have a table with lots of IP addresses. > >> I defined some search_fields and that works well. > >> How can I limit the amount of fetched and displayed rows (and pages)? > >> A filter which slices the QuerySet to display only the first 100 > results, > >> would do it, but I do not know, how to create a filter, which produces > no > >> widgets and does not filter on a specific field. > > Axel > --- > PGP-Key:29E99DD6 ☀ +49 151 2300 9283 ☀ computing @ chaos claudius > > Why do you need to subclass Paginator? The whole point of the class is that it already deals with slicing appropriately. Just set the per-page parameter to whatever you need. -- DR.
-- You received this message because you are subscribed to the Google Groups "Django users" group. To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/zt32rF20SWkJ. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.