On Oct 11, 9:22 am, The Danny Bos <danny...@gmail.com> wrote:
> Heya, thanks for all the help of late, I'm about four late nights from
> finishing my first big app I'm guessing.
>
> Anyway,
> I'm working on paging in my app and am completely stuck (again),
> here's what I'm trying for:
>          eg:http://www.domainname.com/card/pokemon/0-50/
>
> Which would obviously display a list of 'Pokemon' cards from numbers 0
> to 50.
>
> To get those numbers from the URL, I'm doing:
>         paging = str(paging)
>         paging = paging.split("-")
>         page_from = paging[0]
>         page_to = paging[1]
>         items = Cards.objects.all()[page_from:page_to]
>
> Seems to work but may need some error checking, yeh?
>
> Where I'm really stuck is listing out the pages in the template like
> so:
>          <a href="">0-50</a>, <a href="">51-100</a>, <a href="">101-132</a>.
>
> I guess I need to get the Count of the records first, in this case
> "132". Then how would I loop through and create those links
> automatically. As each Card set may be different obviously, some may
> have "43" records, some "682" records etc ... But I still want to page
> through by "50" each time using the URL.
>
> Any help would be great, I'm really stumped on this one.
> Hope that's enough info to get some help.
>
> d

There is a whole section of the documentation devoted to pagination:
http://docs.djangoproject.com/en/dev/topics/pagination/
including some useful built-in functionality.
--
DR.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to