Exemplo n.º 1
0
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)
Exemplo n.º 2
0
def delete_post(id):

    post = Post.find_by_id(id)