好得很程序员自学网

<tfoot draggable='sEl'></tfoot>

flask分页的详细介绍

在我们学习的过程中会遇到这么样的问题,就是在我们学习的过程中会发现需要分页处理,这里呢,给大家介绍书上说的分页。

@app.route('/',methods=['GET'])
@app.route('/<int:page>')
def home(page=1):
	pagination=Post.query.order_by(Post.publish_date.desc()).paginate(page, per_page=10,error_out=False)
	posts = pagination.items
	link,tuijian_post,fenlei=get_tui_link()
	return render_template('home1.html',
                           posts=posts,
                           pagination=pagination,
                           tuijian_post=tuijian_post,fenleis=fenlei,                
                           links=link) 

查看更多关于flask分页的详细介绍的详细内容...

  阅读:37次