From 29e09017942e36ca63aa9427983a7bc8c33b2bf8 Mon Sep 17 00:00:00 2001 From: Dannon Baker Date: Thu, 21 Oct 2021 07:37:54 -0400 Subject: [PATCH] Prefer model class when it exists (assuming it is more correct/refined logic) over column. This fixes history sort to work correctly in grids. --- lib/galaxy/web/framework/helpers/grids.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/galaxy/web/framework/helpers/grids.py b/lib/galaxy/web/framework/helpers/grids.py index 7566e7f635f..be220f00577 100644 --- a/lib/galaxy/web/framework/helpers/grids.py +++ b/lib/galaxy/web/framework/helpers/grids.py @@ -76,9 +76,9 @@ class GridColumn: """Sort query using this column.""" if column_name is None: column_name = self.key - column = self.model_class.table.c.get(column_name) + column = getattr(self.model_class, column_name) if column is None: - column = getattr(self.model_class, column_name) + column = self.model_class.table.c.get(column_name) if ascending: query = query.order_by(column.asc()) else: