I kind of worked out a way, it seems highly flimsy but it's working.
paging = str(paging) paging = paging.split("-") page_from = paging[0] page_to = paging[1] items = CollectionItem.objects.filter(collection=collection) items_paged = CollectionItem.objects.filter (collection=collection).order_by('number')[page_from:page_to] paging_links = [] counter = 0 counter_end = 50 selected = False while counter < len(items): if counter_end > items.count(): counter_end = items.count() print counter print page_from if int(counter) == int(page_from): selected = True else: selected = False paging_links.append({'start': counter, 'end': counter_end, 'selected': selected}) counter += 50 counter_end += counter_end On Oct 11, 8:18 pm, Sam Lai <samuel....@gmail.com> wrote: > 2009/10/11 The Danny Bos <danny...@gmail.com>: > > > > > I had a read of that, is good but seems overly basic for what I'm > > trying to achieve. > > > Basically a list of links like so on the Template: > > > Link: Cards 0-50 > > Link: Cards 51-100 > > Link: Cards 101-132 > > > Know what I mean? > > My biggest question being, how can I create that above list with the > > data I have, basically the record count "132". > > Looking through that linked doc, I'd say you can use the > page.start_index() and page.end_index() properties to give you that > result for each page. > > I haven't used this before, and right now I can't really work out how > to loop through all the pages to print that information out in the > templates, but I'd say I'm just missing something obvious. > > HTH --~--~---------~--~----~------------~-------~--~----~ 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 django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---