Fix auto-creation of grid sorter, when joined table is involved.

This commit is contained in:
Lance Edgar 2016-01-13 02:40:03 -06:00
parent bcb5176718
commit 747471b08a

View file

@ -126,7 +126,8 @@ class AlchemyGrid(Grid):
Returns a function suitable for a sort map callable, with typical logic
built in for sorting applied to ``field``.
"""
column = getattr(self.model_class, model_property.key)
class_ = getattr(model_property, 'class_', self.model_class)
column = getattr(class_, model_property.key)
return lambda q, d: q.order_by(getattr(column, d)())
def load_settings(self):