<div dir="ltr"><div>On Sat, Dec 14, 2013 at 10:09 PM, Guy Jacks <span dir="ltr"><<a href="mailto:guy.jacks@gmail.com" target="_blank">guy.jacks@gmail.com</a>></span> wrote:</div><div>> I have Pony working well for a small app but I can't find any documentation on pagination. Does Pony offer any pagination features?</div>
<div><br></div>Yes, in the development version of Pony (which you can take from GitHub) the query object has "page(pagenum, pagesize)" method. It may be used as in the following examples:<div><br></div><div> select(p for p in Product).page(3) # 10 items per page by default</div>
<div> select(p for p in Product).page(3, pagesize=20) <br><div class="gmail_extra"><br></div></div><div class="gmail_extra">Also it is possible to use slice syntax. The above queries can be equivalently written as:</div>
<div class="gmail_extra"><br></div><div class="gmail_extra"> select(p for p in Product)[20:30]</div><div class="gmail_extra"><div class="gmail_extra"> select(p for p in Product)[40:60]<br><br>When using slice syntax, the general formula is [(pagenum - 1) * pagesize : pagenum * pagesize]<br>
</div><div><br><div>page() method will be included in the upcoming release PonyORM 0.5. All previous releases support slice syntax.<br></div></div></div><div class="gmail_extra"><br></div></div>