def post(self): subject = self.request.get("subject") content = self.request.get("content") if subject and content: post = Post(subject = subject, content = content) post.put() self.top_posts(update=True) self.redirect("/blog/"+str(post.key().id())) else: error = "we need both a subject and content!" self.render_new_post(subject,content,error)
def post(self): subject = self.request.get('subject') content = self.request.get('content') if subject and content: p = Post(parent=Utils().blog_key(), author=self.user, subject=subject, content=content) p.put() return self.redirect('/blog/%s' % str(p.key().id())) else: error = "subject and content are both needed!" self.render("newpost.html", subject=subject, content=content, error=error)
def post(self): if not self.user: return self.redirect("/login") subject = self.request.get('subject') content = self.request.get('content') user_id = self.request.cookies.get('user_id').split('|')[0] if subject and content: p = Post(subject=subject, content=content, user_id=user_id) p.put() l = LikeCount(blog_id=str(p.key().id()), count=0) l.put() self.redirect('/blog/%s' % str(p.key().id())) else: error = "Both subject and content are required!" self.render("newpost.html", subject=subject, content=content, error=error)