title: How to reverse a cursor in djangoappengine?
body: <p>I'm developing and application that requires to paginate a list of links. I'm using django non-rel with djangoappengine.</p>
  
  <p>I'm aware of the functions set_cursor and get_cursor found in djangoappengine.db.utils which make it easy to navigate forward as such:</p>
  
  <pre><code>paginate_by = 25
  queryset = Link.objects.all()
  
  cursor = request.GET.get('cursor') #Alternatively passed via ajax in a POST request
  if cursor:
      queryset = set_cursor(queryset, cursor)
  
  links = queryset[0:paginate_by]
  next_cursor = get_cursor(links)
  </code></pre>
  
  <p>However, I'm struggling to navigate backwards. The official procedure in GAE is to <a href="https://developers.google.com/appengine/docs/python/ndb/queries#cursors" rel="nofollow">reverse the cursor and to use a reversed query</a>. This makes use of a <a href="http://code.google.com/p/googleappengine/source/browse/trunk/python/google/appengine/datastore/datastore_query.py?r=229#1403" rel="nofollow">reversed()</a> function that is part of the Cursor class, which I'm unsure I can access in Django.</p>
  
  <p>But how do I reverse a cursor in djangoappengie?</p>
  
  <p>In case it is not possible I believe that the alternative is to store the cursors client side, pass them via ajax, and then generate a query based on page number. I would prefer to follow the official procedures as much as possible, though.</p>
  
  <p>Thanks </p>