Im using the module flask-paginate found here: http://pythonhosted.org/Flask-paginate/
I am able to return results, and my pagination begins with the correct number of pages, but its currently showing 69 results per page. The documentation shows per_page= , but this only affects my starting page number which is correct. Im using SQL-Alchemy for my db.
@search.route('/search')
def search():
page, per_page, offset, inner_window = get_page_items()
links = Item.query.all()
total = Item.query.count()
pagination = get_pagination(page=page,
per_page=per_page,
total = total,
format_total=True,
format_number=True,
record_name='links',
)
return render_template('search/searchPage.html', offset=offset, total=total, links=links, pagination=pagination, per_page=per_page, page=page)
def get_css_framework():
return 'bootstrap3'
def get_link_size():
return 'sm' #option lg
def show_single_page_or_not():
return False
def get_page_items():
page = int(request.args.get('page', 1))
per_page = 10
inner_window=10
offset = (page) * 10
return page, per_page, offset, inner_window
def get_pagination(**kwargs):
kwargs.setdefault('record_name', 'repositories')
return Pagination(css_framework=get_css_framework(),
link_size=get_link_size(),
show_single_page=show_single_page_or_not(),
**kwargs
)