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