Skip to content

Commit

Permalink
Merge pull request #315 from eirnym/model-query-none
Browse files Browse the repository at this point in the history
If model has query, but it has no attribute filter, use session
  • Loading branch information
jfinkels committed Jul 15, 2014
2 parents a295a77 + 916fd92 commit 94d9048
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions flask_restless/helpers.py
Expand Up @@ -76,8 +76,11 @@ def session_query(session, model):
"""
if hasattr(model, 'query'):
if callable(model.query):
return model.query()
return model.query
query = model.query()
else:
query = model.query
if hasattr(query, 'filter'):
return query
return session.query(model)


Expand Down

0 comments on commit 94d9048

Please sign in to comment.