(queryset, page_size)
Paginates using auto-incremented integer primary key ``id`` instead
    of offset (not an actual database cursor).

    Credit: http://cra.mr/2011/03/08/building-cursors-for-the-disqus-api
Paginates using auto-incremented integer primary key ``id`` instead
    of offset (not an actual database cursor).
Paginates using auto - incremented integer primary key id instead of offset ( not an actual database cursor ) .
def cursor_paginated(queryset, page_size):
    """
    Paginates using auto-incremented integer primary key ``id`` instead
    of offset (not an actual database cursor).

    Credit: http://cra.mr/2011/03/08/building-cursors-for-the-disqus-api
    """
    next_id = 0
    while True:
        page = list(queryset.filter(id__gte=next_id)[:page_size])
        if not page:
            return
        yield page
        if len(page) < page_size:
            return
        next_id = page[-1].id + 1
def cursor_paginated ( queryset , page_size ) : next_id = 0 while True : page = list ( queryset . filter ( id__gte = next_id ) [ : page_size ] ) if not page : return yield page if len ( page ) < page_size : return next_id = page [ - 1 ] . id + 1