Skip to content

Commit

Permalink
fix multiple join error in sqlalchemy 1.0.2
Browse files Browse the repository at this point in the history
  • Loading branch information
elvis committed Apr 29, 2015
1 parent 21c10ce commit 9b06b95
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion flask_restless/search.py
Original file line number Diff line number Diff line change
Expand Up @@ -495,7 +495,8 @@ def create_query(session, model, search_params, _ignore_order_by=False):
relation_model = relation.mapper.class_
field = getattr(relation_model, field_name_in_relation)
direction = getattr(field, val.direction)
query = query.join(relation_model)
if relation_model not in [j.mapper.class_ for j in query._join_entities]:
query = query.join(relation_model)
query = query.order_by(direction())
else:
field = getattr(model, val.field)
Expand Down

0 comments on commit 9b06b95

Please sign in to comment.