コード例 #1
0
ファイル: views.py プロジェクト: saiashirwad/sem
def show_post(id):    

    form = CommentForm()

    post = Post.find_by_id(id)
    user_id = session['user'].id 

    if form.validate_on_submit():

        comment = Comment(
            user_id = user_id,
            post_id = id,
            text = form.comment.data
        )

        comment.create()

        return redirect(url_for('show_post', id=id))

    comments = Post.get_post_comments(id)

    print(comments)

    return render_template('post.html', user=session['user'], post=post, form=form, comments=comments)
コード例 #2
0
ファイル: views.py プロジェクト: saiashirwad/sem
def delete_post(id):

    post = Post.find_by_id(id)