Commit 809169cd authored by Cosmia Fu's avatar Cosmia Fu

fixed ambiguous column error when order a model mapped against more

than one database table by the duplicate-named column.
parent 09982090
...@@ -693,6 +693,7 @@ class ModelView(BaseModelView): ...@@ -693,6 +693,7 @@ class ModelView(BaseModelView):
joins.add(table.name) joins.add(table.name)
if sort_field is not None: if sort_field is not None:
sort_field = getattr(self.model, sort_field, sort_field)
if sort_desc: if sort_desc:
query = query.order_by(desc(sort_field)) query = query.order_by(desc(sort_field))
else: else:
......
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