article pagination
This commit is contained in:
@@ -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
|
||||||
|
|||||||
Reference in New Issue
Block a user