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

@@ -8,7 +8,7 @@ class OrgController(BaseController):
def get_articles(self,id):
sid=db_session.query(Section.id).filter(Section.organization_id==id).all()
sid=map(lambda a:a[0], sid)
articles=Article.query.filter(Article.section_id.in_(sid)).all()
articles=db_session.query(Article).filter(Article.section_id.in_(sid)).all()
return articles
def get_by_key_articles(self,key):
@@ -16,6 +16,6 @@ class OrgController(BaseController):
return self.get_articles(org.id)
def get_by_key(self,key):
return Organization.query.filter(Organization.key==key).one()
return db_session.query(Organization).filter(Organization.key==key).one()
controller=OrgController()