If model has query, but it has no attribute filter, use session

Query is None for models with latest Flask-SQLAlchemy.
https://github.com/mitsuhiko/flask-sqlalchemy/blob/master/flask_sqlalchemy/__init__.py#L567
Merge pull request #315 from eirnym/model-query-none

If model has query, but it has no attribute filter, use session