summaryrefslogtreecommitdiff
path: root/ishtar_common/widgets.py
diff options
context:
space:
mode:
authorÉtienne Loks <etienne.loks@iggdrasil.net>2023-01-10 13:08:48 +0100
committerÉtienne Loks <etienne.loks@iggdrasil.net>2023-01-12 09:50:56 +0100
commita060b26ee54f8f2e95ad812faff3ef0511accf3e (patch)
tree79a9647f9e8563d44d08123dd4844a249001e63a /ishtar_common/widgets.py
parent79aaca219772200a5456854ba5102a1c59a36aa1 (diff)
downloadIshtar-a060b26ee54f8f2e95ad812faff3ef0511accf3e.tar.bz2
Ishtar-a060b26ee54f8f2e95ad812faff3ef0511accf3e.zip
Syndication - export external sources
Diffstat (limited to 'ishtar_common/widgets.py')
-rw-r--r--ishtar_common/widgets.py20
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 = "", ""