def get(self,id): user = authenticatedUser(sessions.Session()) blogpost = BlogPostModel.get_by_id(int(id), parent=None) template_values = { 'menulinks': menuLinks(), 'user': user, 'post': blogpost, } path = os.path.join(os.path.dirname(__file__), 'editPost.html') self.response.out.write(template.render(path, template_values))
def post(self,id): if authenticatedUser(sessions.Session()): blogpost = BlogPostModel.get_by_id(int(id), parent=None) blogpost.title = self.request.get('title') blogpost.content = self.request.get('content') blogpost.updated = DateTimeProperty.now() blogpost.put() self.redirect('/') else: self.redirect('/login/')
def get(self,id): blogpost = BlogPostModel.get_by_id(int(id), parent=None) db.delete(blogpost) self.redirect('/')