Пример #1
0
def article_detail(article_id):
    article, category = get_article(article_id)
    pre_id, pre_title = get_pre_article(article)
    next_id, next_title = get_next_article(article)
    categories = get_categories()
    return render_template('detail.html', article=article, categories=categories,
                           pre_article={'id': pre_id, 'title': pre_title},
                           next_article={'id': next_id, 'title': next_title}, category=category)
Пример #2
0
def tag_classify(tag, page_num):
    total = get_articles_count(tag=tag)
    pre, behind = page_slice('/tag/{}'.format(tag), total, page_num, page_size)
    articles = get_articles(tag=tag, page_num=page_num, page_size=page_size)
    categories = get_categories()
    return render_template('index.html', articles=articles, categories=categories, pre=pre, behind=behind)
Пример #3
0
def category_classify(category, page_num):
    total = get_articles_count(category=category)
    pre, behind = page_slice('/category/{}'.format(category), total, page_num, page_size)
    articles = get_articles(category=category, page_num=page_num, page_size=page_size)
    categories = get_categories()
    return render_template('index.html', articles=articles, categories=categories, pre=pre, behind=behind)
Пример #4
0
def article_list(page_num):
    total = get_articles_count()
    pre, behind = page_slice('/article', total, page_num, page_size)
    articles = get_articles(page_num=page_num, page_size=page_size)
    categories = get_categories()
    return render_template('index.html', articles=articles, categories=categories, pre=pre, behind=behind)