def delete_category_lib(self, id): categorys = Category.by_id(id) tags = Tag.all() if categorys is None: return Category.all(), tags self.db.delete(categorys) self.db.commit() return Category.all(), tags
def article_list_lib(self): """01文章列表页"""s articles = dbSession.query(Article).order_by(Article.createtime.desc()).all() comments = dbSession.query(Comment).order_by(Comment.createtime.desc()).all() tags = Tag.all() categorys = Category.all() return articles, comments, tags, categorys
def delete_tag_lib(self, id): tags = Tag.by_id(id) categorys = Category.all() if tags is None: return categorys, Tag.all() self.db.delete(tags) self.db.commit() return categorys, Tag.all()
def search_article_lib(self, category_id, tag_id): if tag_id is not None: tag = Tag.by_id(tag_id) articles = tag.articles if category_id is not None: category = Category.by_id(category_id) articles = category.articles comments = dbSession.query(Comment).order_by( Comment.createtime.desc()).all() tags = Tag.all() categorys = Category.all() return articles, comments, tags, categorys
def get_tags_categorys_lib(self): """02返回标签和分类""" tags = Tag.all() categorys = Category.all() return tags, categorys
def get_tags_categorys_lib(self): ''' 上传文章 的页面需要的数据 ''' tags = Tag.all() categorys = Category.all() return tags, categorys
def get_article_lib(self): articles = Article.all_createtime_desc() categorys = Category.all() tags = Tag.all() return articles, categorys, tags
def get_tags_categorys_lib(self): tags = Tag.all() categorys = Category.all() return tags, categorys
def get_tags_categorys_lib(self): '''获取标签和分类''' tags = Tag.all() categorys = Category.all() return tags, categorys
def get_tags_categorys(self): categorys = Category.all() tags = Tag.all() return categorys, tags