def get_stat(value): if value == 4: last_post, count = Post.pagination() return last_post elif value == 5: last_comments, count = Comment.pagination() return last_comments elif value == 6: last_categories, count = Category.pagination() return last_categories else: return 0
def index(page=1): limit = 5 posts, count = Post.pagination(limit=limit, page=page) pagination = Pagination(page=page, per_page=limit, total=count, record_name=gettext('posts'), alignment='right', bs_version=3) return render_template("blog/index.html", title=gettext('Home'), posts=posts, pagination=pagination)