__init__.py 文件源码

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

项目:Canella-CMS 作者: mush42 项目源码 文件源码
def post_view(slug):
    q = filter_by_user(Post.query.filter(Post.slug==slug))
    post = q.one_or_none()
    if post is None:
        return render_page_template(
        context={"post": None},
        template="site/blog/post.html"
        )
    form = Form()
    if post.enable_comments and current_settings.enable_comments:
        form = create_comment_form()
        if form.validate_on_submit():
            post.comments.append(Comment(**form.data))
            db.session.commit()
            flash("Your comment was sent")
            return redirect(url_for('canella-blog.post', slug=post.slug))
    return render_page_template(
        context={"post": post, 'comment_form':form},
        template="site/blog/post.html"
    )
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号