예제 #1
0
def newcomment(postId):

    form = CommentForm()
    post = Post.objects.get(pk=postId)
    if form.validate_on_submit():
        newComment = Comment(comment=form.comment.data,
                             user=ObjectId(session['currUserId']),
                             post=post.id)
        newComment.save()
        newComment.reload()
        return redirect('/post/' + postId)
    return render_template('commentform.html', post=post, form=form)
예제 #2
0
def post(postId):
  
    post = Post.objects.get(pk=postId)
    comments = Comment.objects(post=postId)
    return render_template('post.html',post=post,comments=comments)