def get(self): categories = Category.get_all_names_with_paths() tags = Tag.get_all() self.render('admin/create_article.html', { 'title': '发表新文章', 'page': 'create_article', 'categories': categories, 'tags': sorted(tags) })
def get(self, article_id): article_id = int(article_id) if not article_id: raise HTTPError(404) article = Article.get_by_id(article_id) if not article: raise HTTPError(404) categories = Category.get_all_names_with_paths() tags = Tag.get_all() self.render('admin/edit_article.html', { 'title': u'编辑《%s》' % article.title, 'page': 'edit_article', 'article': article, 'categories': categories, 'tags': sorted(tags) })