|
PageLinks
A utility class to produce a list of page links for navigation
AboutPageLinks is a simple utility for producing a list of link URL and link text pairs. This is useful for the common convention of displaying a hyper-linked list of pages for page navigation.
PageLinks takes as input
And returns a sequence of pairs (label, URL), including
WhereYou can find the PagedLinks class in he3/db/tower/paging.py UsageTo use the PageLinks class, simple instantiate it using its constructor, providing all of its required information in the process: myLinks = PageLinks(page=10, page_count=20, url_root="/myresource", page_field="pg", page_range=3) To get the list of links simple call the get_links() method. page_navigation_links = myLinks.get_links() In the above the case, the beginning of page_navigation_links looks something like this: >>> page_navigation_links
>>> [('Prev','/myresource?pg=9'),('6','/myresource?pg=6'), ('7','/myresource?pg=7'), ...]
|
► Sign in to add a comment
page_field="pg"
So I think it should be (replace ?page=x with ?pg=x) >>> [('Prev','/myresource?pg=9'),('6','/myresource?pg=6'), ('7','/myresource?pg=7'), ...]
Good catch. Of course I put that there on purpose :)
Hi there, The source files seems to be missing. You're linking to he3/db/tower/paging.py on this page (too).
Hi Ian, PageLinks is in the same module (paging.py) as PagedQuery. Scroll down :)