Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

ndb Paging and flask #58

Open
houmie opened this Issue Jul 31, 2013 · 0 comments

Comments

Projects
None yet
1 participant

houmie commented Jul 31, 2013

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

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