def load_more_posts(obj_response, group, name, older_than):
posts = Post.get_more(group=group, name=name, older_than=older_than)
render_post = get_template_attribute('macros.html', 'render_post')
more_posts_panel = get_template_attribute('macros.html', 'more_posts_panel')
if posts:
for post in posts:
obj_response.html_append('#post-container', render_post(post, current_user).unescape())
obj_response.html('#load_more_container', more_posts_panel(group, name, posts[-1].date).unescape())
# refresh and re-enable waypoint to achieve continuous loading
obj_response.script('Waypoint.refreshAll()')
obj_response.script('Waypoint.enableAll()')
else:
obj_response.html('#load_more_container', more_posts_panel(group, name, None).unescape())
评论列表
文章目录