def new_post(self, title, content, date=datetime.datetime.utcnow()): post = Post(blog_id=self._id, title=title, content=content, author=self.author, created_date=date) post.save_to_mongo()
def create_new_post(blog_id): if request.method == 'GET': return render_template('new_post.html', blog_id=blog_id) else: title = request.form['title'] content = request.form['content'] user = User.get_by_email(session['email']) new_post = Post(blog_id, title, content, user.email) new_post.save_to_mongo() return make_response(blog_posts(blog_id))