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)
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)
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)