def get(self, action=None, key=None): if action: if action == 'edit' and key: page = Post.get_single_by_key(key) self.render('posts.edit', { 'post': page, 'post_type': 'page' }) elif action == 'new': self.render('posts.edit', { 'post': {}, 'post_type': 'page' }) elif action == 'publish': post = Post.get_single_by_key(key) post.publish() return self.redirect_back() else: self.redirect_back() else: posts = Post.get_pages(num=100, cached=False) self.render('posts', { 'posts': posts, 'post_type': 'page' })
def get(self, action=None, key=None): if action: if action == 'delete': status = Post.get_single_by_key(key) status.delete() return self.redirect_back('deleted') return self.redirect_back('noaction') posts = Post.get_statuses(num=100, cached=False) self.render('statuses', { 'posts': posts, 'post_type': 'status' })