use db_session for articles and sections

This commit is contained in:
Andreas Stephanides
2017-02-21 19:55:19 +01:00
parent ae2f61485e
commit 4a935ee4a9
9 changed files with 18 additions and 41 deletions

View File

@@ -15,7 +15,7 @@ import flask
@section_pages.route("")
@section_pages.route(".json")
def index():
sections=Section.query.all()
sections=controller.get_all()
return jsonify(sections=sections)
@@ -29,9 +29,7 @@ def update(id):
@section_pages.route("/<int:id>",methods=['GET'])
@section_pages.route("/<int:id>.json",methods=['GET'])
def get(id):
section=Section.query.get(id)
clogger.info(section)
# section=SectionSchema().dump(section)[0]
section=controller.get(id)
return jsonify(section=section)
@@ -39,7 +37,7 @@ def get(id):
@section_pages.route("/<int:id>/articles.json",methods=['GET'])
def get_articles(id):
v=request.values
pp,o=article_controller.pagination_params(v) # extract per_page and offset from params
pp,o=article_controller.pagination_params(v)
articles=article_controller.get_section_page(id,pp,o)
resp = jsonify(articles=articles)