diff options
author | Sam | 2013-12-30 03:45:27 +0000 |
---|---|---|
committer | Sam | 2013-12-30 03:45:27 +0000 |
commit | 957ec58b605af421947335197ed09eddf72479a0 (patch) | |
tree | dede39ac510fc777f4d40cf9efb483b158339b10 /wqflask/wqflask/model.py | |
parent | 51f1049ef5a6b78f02f9fc44e970b80eb64603f1 (diff) | |
download | genenetwork2-957ec58b605af421947335197ed09eddf72479a0.tar.gz |
Collections changes
Diffstat (limited to 'wqflask/wqflask/model.py')
-rw-r--r-- | wqflask/wqflask/model.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/wqflask/wqflask/model.py b/wqflask/wqflask/model.py index b508f18e..192aedd0 100644 --- a/wqflask/wqflask/model.py +++ b/wqflask/wqflask/model.py @@ -57,8 +57,16 @@ class User(Base): user_collections = relationship("UserCollection", order_by="asc(UserCollection.name)", + lazy='dynamic', ) + def get_collection_by_name(self, collection_name): + try: + collect = self.user_collections.filter_by(name=collection_name).one() + except sqlalchemy.orm.exc.NoResultFound: + collect = None + return collect + @property def name_and_org(self): """Nice shortcut for printing out who the user is""" |