jeudi 9 mars 2017

List of 1000, create multiple pages with flask-paginate

So I have a list of items say around 1000 and want to create multiple pages using pagination so that all 1000 items does not get listed in one page. How do I go about doing this? I'm currently using flask as the front end framework and tried to use flask-paginate, but it does not seem to work. Can anyone give me guidance? Thanks





python

> @app.route('/search/<int:page>')
> def search(page=1):
> page = request.args.get('page', type=int, default=1) 
> users = ['test1','test2', 'test3'] # Should be 1000 values or so 
> pagination = Pagination(page=page, total=len(users), search=True, record_name='users') 
> return render_template("search.html", users=users,
>                        search_query=search_query, pagination=pagination,)




Aucun commentaire:

Enregistrer un commentaire