views.py 文件源码

python
阅读 39 收藏 0 点赞 0 评论 0

项目:tingsmen 作者: pasqu4le 项目源码 文件源码
def load_comments(obj_response, post_id, depth):
    comments = Post.query.filter_by(parent_id=post_id).order_by(Post.date)
    if comments:
        render_comment = get_template_attribute('macros.html', 'render_comment')
        # clear the comments displayed (to avoid double loading of inserted comments)
        obj_response.html(''.join(['#post-', str(post_id), '-comments']), '')
        for comment in comments:
            obj_response.html_append(''.join(['#post-', str(post_id), '-comments']),
                                     render_comment(comment, current_user, depth).unescape())
        # change the button to hide the comments if pressed again
        obj_response.script(''.join(['$("#load_comment_button_', str(post_id), '").attr("onclick", "hide_comments(',
                                     str(post_id), ',', str(depth), ')")']))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号