use db_session for articles and sections
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user