article pagination

This commit is contained in:
Andreas Stephanides
2017-01-21 22:08:05 +01:00
parent 7271157d11
commit 6aba382052

View File

@@ -20,7 +20,16 @@ import controller
@article_pages.route("") @article_pages.route("")
@article_pages.route(".json") @article_pages.route(".json")
def index(): def index():
articles=controller.get_all(20,0) v=request.values
if v.has_key("per_page"):
pp=v["per_page"]
else:
pp=20
if v.has_key(:page):
o=(page-1) *pp
else:
o=0
articles=controller.get_all_page(pp,o)
resp = jsonify(articles=articles) resp = jsonify(articles=articles)
resp.headers['Pagination-Limit']=20 resp.headers['Pagination-Limit']=20
resp.headers['Pagination-Offset']=10 resp.headers['Pagination-Offset']=10