Example #1
0
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
Example #2
0
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
Example #3
0
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()
Example #4
0
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
Example #5
0
def get_tags_categorys_lib(self):
    """02返回标签和分类"""
    tags = Tag.all()
    categorys = Category.all()
    return tags, categorys
Example #6
0
def get_tags_categorys_lib(self):
    ''' 上传文章 的页面需要的数据 '''
    tags = Tag.all()
    categorys = Category.all()
    return tags, categorys
Example #7
0
def get_article_lib(self):
    articles = Article.all_createtime_desc()
    categorys = Category.all()
    tags = Tag.all()
    return articles, categorys, tags
Example #8
0
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
Example #10
0
def get_tags_categorys(self):
    categorys = Category.all()
    tags = Tag.all()
    return categorys, tags