Commit da1e16a2 authored by Serge S. Koval's avatar Serge S. Koval

SQLAlchemy 0.8 support

parent 4f1df6d3
...@@ -658,7 +658,14 @@ class ModelView(BaseModelView): ...@@ -658,7 +658,14 @@ class ModelView(BaseModelView):
query = query.join(parts[0]) query = query.join(parts[0])
joins.add(parts[0]) joins.add(parts[0])
elif isinstance(sort_field, InstrumentedAttribute): elif isinstance(sort_field, InstrumentedAttribute):
table = sort_field.parententity.tables[0] # SQLAlchemy 0.8+ uses 'parent' as a name
mapper = getattr(sort_field, 'parent', None)
if mapper is None:
# SQLAlchemy 0.7.x uses parententity
mapper = getattr(sort_field, 'parententity', None)
if mapper is not None:
table = mapper.tables[0]
if table.name not in joins: if table.name not in joins:
query = query.join(table) query = query.join(table)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment