From 061edbaac5a37b8e717391c3b7d804a96c041979 Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Tue, 10 Jan 2023 13:08:48 +0100 Subject: Syndication - export external sources --- ishtar_common/widgets.py | 20 +++++--------------- 1 file changed, 5 insertions(+), 15 deletions(-) (limited to 'ishtar_common/widgets.py') 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 = "", "" -- cgit v1.2.3