def post(self): user = self.check_login_status() title = self.request.get("subject") post = self.request.get("content") if not title or not post: self.render( "newpost.html", title=title, post=post, user=user, error="A post requires both a title and content." ) else: blogpost = BlogPost(title=title, post=post, author_id=user.key().id()) blogpost.put() get_latest(True) self.redirect("/blog/%s" % str(blogpost.key().id()))
def persist(self, subject,content): newpost = BlogPost(); newpost.subject = subject; newpost.content = content; newpost.put() return newpost.key.id()