Beispiel #1
0
def article_list_lib(self):
    ''' 显示文档首页 需要的数据'''
    articles = Article.all_createtime_desc()
    comments = Comment.all_createtime_desc()
    # tags = Tag.all()
    # categorys = Category.all()
    tags, categorys = get_tags_categorys_lib(self)
    return articles, comments, categorys, tags
Beispiel #2
0
def article_search_lib(self, category_id, tag_id):
    if tag_id != '':
        tag = Tag.by_id(tag_id)
        articles = tag.articles
    if category_id != '':
        category = Category.by_id(category_id)
        articles = category.articles

    tags, categorys = get_tags_categorys_lib(self)
    comments = Comment.all_createtime_desc()
    return articles, comments, categorys, tags
def article_search_list_lib(self, category_id, tag_id):
    '''查找'''
    if category_id != '':
        category = Category.by_id(category_id)  # 获取分类
        articles = category.articles  # 获取该分类的文章
    if tag_id != '':
        tag = Tag.by_id(tag_id)  # 获取标签
        articles = tag.articles  # 获取该标签的文章
    comments = Comment.all_createtime_desc()  # 获取所有评论
    tags, categorys = get_tags_categorys_lib(self)  # 获取标签和分类
    return articles, comments, categorys, tags  # 返回这些参数赋值给handler
Beispiel #4
0
def article_list_lib(self):
    articles = Article.all_createtime_desc()
    comments = Comment.all_createtime_desc()
    tags, categorys = get_tags_categorys_lib(self)

    return articles, comments, categorys, tags