Exemplo n.º 1
0
def Life():
    page = request.args.get('page', 1, type=int)
    pagination = models.Article.query.filter(models.Article.category == 'life').order_by(models.Article.timestamp.desc()).paginate(page, per_page=app.config['FLASKY_POSTS_PER_PAGE'],error_out=False)
    articles = pagination.items
    allArticles = models.Article.query.all();
    recentArticles = models.Article.query.order_by(models.Article.timestamp.desc())[0:7]
    tagArticle = service.isContainTag(allArticles,"life")

    return render_template("life.html",articles = articles,pagination = pagination,recentArticles=recentArticles,tags = list(service.splitTags(allArticles)),tagArticle=tagArticle)
Exemplo n.º 2
0
def category():
    kind = request.args.get('kind')
    page = request.args.get('page', 1, type=int)
    pagination = models.Article.query.filter(models.Article.category == kind).order_by(models.Article.timestamp.desc()).paginate(page, per_page=app.config['FLASKY_POSTS_PER_PAGE'],error_out=False)
    articles = pagination.items
    allArticles = models.Article.query.all();
    recentArticles = models.Article.query.order_by(models.Article.timestamp.desc())[0:7]
    return render_template("category.html",articles = articles,pagination = pagination,tags = list(service.splitTags(allArticles)),recentArticles = recentArticles)