use joinedload to only hit the database once per request

also:

* only include active orgs
* write lots of tests
This commit is contained in:
Leo Hemsted
2018-03-13 13:07:02 +00:00
parent 91fa475645
commit 5871dee606
4 changed files with 150 additions and 8 deletions

View File

@@ -116,11 +116,11 @@ class User(db.Model):
services = db.relationship(
'Service',
secondary='user_to_service',
backref=db.backref('user_to_service', lazy='dynamic'))
backref='user_to_service')
organisations = db.relationship(
'Organisation',
secondary='user_to_organisation',
backref=db.backref('users', lazy='dynamic'))
backref='users')
@property
def password(self):