def post(self, post_id): comment = self.request.get('comment') poster = str(self.request.cookies.get('username')) new_comment = Comment.create_new_comment(int(post_id), comment, poster) self.increment_num_comment(post_id) if (comment and poster and new_comment): new_comment.put() self.redirect('/')
def write_form(self, post_id): post = Post.get_by_id(int(post_id)) qry1 = Comment.query() cursor = qry1.filter(Comment.post_id == int(post_id)) username = self.request.cookies.get('username') if username: render(self, 'post_page.html', post = post, post_id = int(post_id), username = username, cursor = cursor) else: render(self, 'post_page_2.html', post = post, post_id = int(post_id), cursor = cursor)