Can anyone point me to a practical application of cursor()
to do pagination?
I am not clear how to use cursor()
as given in the documentat
Here's a simple example to get you started...
query = db.GqlQuery("SELECT * FROM Item ORDER BY date DESC")
cursor = self.request.get('cursor')
if cursor: query.with_cursor(cursor)
items = query.fetch(30)
cursor = query.cursor()
... your regular output ...
self.response.out.write('<a href="yoururl?cursor=%s">Next Page</a>' % cursor)