Skip to content
This repository was archived by the owner on Dec 25, 2019. It is now read-only.
This repository was archived by the owner on Dec 25, 2019. It is now read-only.

ndb Paging and flask #58

Description

@houmie

Hi,

I love this project, it helped us a lot getting flask deployed on gae.

The simple examples were simply awesome to understand the underlying ndb as well. Very useful indeed.

I have a suggestion for this project:

One thing that is missing though, is paging in ndb and how to handle that in flask.

There is this excellent paging demo in flask, which however uses SQLAlchemy:

https://github.com/mitsuhiko/flask-feedback

demo to be seen online:
http://feedback.flask.pocoo.org/

I was trying to adjust that to use ndb instead of alchemy, and can't get it fully right.

def show_feedback(kind, page):
    """Renders returned feedback."""
    curs = Cursor(urlsafe=request.args.get('cursor'))
    feedback_for_page, next_cursor, more = Feedback.query().filter(Feedback.kind==Feedback.KINDS[kind]).order(-Feedback.pub_date, Feedback.key).fetch_page(page, start_cursor=curs)
    return render_template('show_feedback.html', kind=kind, feedback_for_page=feedback_for_page, next_cursor=next_cursor, more=more)

It would be so awesome providing an example snippet in this project how to use gae-paging within flask.

Regards,
Hooman

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions