diff options
Diffstat (limited to 'ishtar_common/widgets.py')
-rw-r--r-- | ishtar_common/widgets.py | 20 |
1 files changed, 5 insertions, 15 deletions
diff --git a/ishtar_common/widgets.py b/ishtar_common/widgets.py index a6a621cbe..57dc1a730 100644 --- a/ishtar_common/widgets.py +++ b/ishtar_common/widgets.py @@ -44,7 +44,7 @@ from json import JSONEncoder from django.utils.translation import ugettext_lazy as _ from ishtar_common import models -from ishtar_common.utils import reverse_coordinates +from ishtar_common.utils import get_columns_from_class, reverse_coordinates logger = logging.getLogger(__name__) @@ -1204,20 +1204,10 @@ class DataTable(Select2Media, forms.RadioSelect): def get_cols(self, python=False): jq_col_names, extra_cols = [], [] - col_labels = {} - slug = getattr(self.associated_model, "SLUG", None) - if hasattr(self.associated_model, "COL_LABELS"): - col_labels = self.associated_model.COL_LABELS - if slug in settings.COL_LABELS: - col_labels.update(settings.COL_LABELS[slug]) - tb_key = (slug, self.table_cols) - if tb_key in settings.TABLE_COLS: - table_cols = settings.TABLE_COLS[tb_key] - else: - table_cols = getattr(self.associated_model, self.table_cols) - if callable(table_cols): - table_cols = table_cols() - + table_cols, col_labels = get_columns_from_class( + self.associated_model, + table_cols_attr=self.table_cols + ) for col_names in table_cols: field_verbose_names = [] field_verbose_name, field_name = "", "" |