Esempio n. 1
0
def index_num():
    page = is_num(request.args.get('page'))
    book_all_tags = Books.query.distinct(Books.tag)
    books = Books.query.distinct(Books.name).paginate(page, 18, True)
    return render_template('book/book.html',
                           books=books,
                           book_all_tags=book_all_tags)
Esempio n. 2
0
def category(category):
    page = is_num(request.args.get('page'))
    articles = Articles.query.filter(func.lower(
        Articles.category) == func.lower(category)).paginate(page, 6, True)
    return render_template('blog/blog_category.html',
                           articles=articles,
                           category=category)
Esempio n. 3
0
def archives():
    page = is_num(request.args.get('page'))
    articles = Articles.query.paginate(page, 30, True)
    all_tags = Tags.query.distinct(Tags.name).all()
    return render_template('blog/blog_archives.html',
                           articles=articles,
                           all_tags=all_tags)
Esempio n. 4
0
def index():
    '''每页显示6篇,且按照时间排序 '''
    page = is_num(request.args.get('page'))
    articles = Articles.query.paginate(page, 6, True)
    all_tags = Tags.query.distinct(Tags.name).all()
    return render_template('blog/blog.html',
                           articles=articles,
                           all_tags=all_tags)
Esempio n. 5
0
def tag(tag):
    page = is_num(request.args.get('page'))
    articles = Articles.query.join(Articles.tags).filter(func.lower(
        Tags.name) == func.lower(tag)).paginate(page, 6, True)
    all_tags = Tags.query.distinct(Tags.name).all()
    tag = tag
    return render_template('blog/blog_tag.html',
                           articles=articles,
                           tag=tag,
                           all_tags=all_tags)
Esempio n. 6
0
def category(category):
    all_article = Articles.load_by_category(category)
    if all_article is None:
        abort(404)
    page = is_num(request.args.get('page'))
    articles = Articles.query.filter(func.lower(
        Articles.category) == func.lower(category)).paginate(page, 6, True)
    all_tags = Tags.query.distinct(Tags.name).all()
    category = category
    return render_template('blog/blog_category.html',
                           articles=articles,
                           all_tags=all_tags,
                           category=category)
Esempio n. 7
0
def archives():
    page = is_num(request.args.get('page'))
    articles = Articles.query.paginate(page, 30, True)
    return render_template('blog/blog_archives.html', articles=articles)
Esempio n. 8
0
def tag(tag):
    page = is_num(request.args.get('page'))
    articles = Articles.query.join(Articles.tags).filter(func.lower(
        Tags.name) == func.lower(tag)).paginate(page, 6, True)
    return render_template('blog/blog_tag.html', articles=articles, tag=tag)
Esempio n. 9
0
def index():
    '''每页显示6篇,且按照时间排序 '''
    page = is_num(request.args.get('page'))
    articles = Articles.query.paginate(page, 6, True)
    return render_template('blog/blog.html', articles=articles)