Essentially, I have a profile page with comments that get displayed. I would like to display 10 posts, and then load 10 more posts when the user scrolls to the bottom of the page (like facebook).
I’m just wondering what the best way to go about is?
What I have now is a Query object:
posts = db.GqlQuery("select * from Profile_Comments WHERE name_of_profile =:1 order by date_created desc", profile_id)
And a for loop in my jinja template that gets the posts:
{% for post_tmp in posts %}
{{post_tmp.post.replace('\r\n', '<br>') | safe }}
{% endfor %}
Does anyone know how to go about doing this? Thanks!!!
One option is to use a tool/plugin like this one, which will ‘progressively enhance’ your page by finding previous/next links and automatically loading and including them at runtime when users scroll far enough.
You can do this yourself, of course. In either case, you should definitely learn about Cursors in App Engine, which will allow you to fetch subsequent pages of results without the datastore having to skip over already viewed results.