Beispiel #1
0
def blog_post(post_id):
    post = Post.findOnebyId(post_id)
    comments = []
    if len(post.comments) != 0:
        for comment_id in post.comments:
            comments.append(Comment.findById(comment_id))
    return render_template("post.html", post=post, comments=comments)
Beispiel #2
0
def create_post_comment(post_id, post_author):
    commenter = request.form['commenter']
    comment = Comment(commenter, post_author, post_id)
    comment.save_database()
    post = Post.findOnebyId(post_id)
    post.comments.append(comment.id)
    post.update_record(post.json())
    return make_response(blog_post(post_id))