def blog_posts(blog_id): blog = Blog.getOneBlog(blog_id) posts = blog.get_posts() return render_template("posts_listing.html", posts=posts, blog_name=blog.title, blog_id=blog_id)
def create_newpost(blog_id): if request.method == 'GET': return render_template("newpost.html", blog_id=blog_id) else: title = request.form['title'] content = request.form['content'] blog = Blog.getOneBlog(blog_id) post = Post(blog_id=blog.id, title=title, content=content, author=blog.author, created_at=0, _id=0) post.save_database() return make_response(blog_posts(blog.id))
def new_post(blog_id,title,content): blog = Blog.getOneBlog(blog_id) blog.new_post(title,content)