From a15f6165f04cc249a42edde5f01851ccd2d7d4ac Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Wed, 24 Feb 2016 01:58:25 +0100 Subject: Fix dynamic table display in ODT and PDF --- ishtar_common/widgets.py | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) (limited to 'ishtar_common/widgets.py') diff --git a/ishtar_common/widgets.py b/ishtar_common/widgets.py index 688648e10..57aa8cf69 100644 --- a/ishtar_common/widgets.py +++ b/ishtar_common/widgets.py @@ -524,7 +524,7 @@ class JQueryJqGrid(forms.RadioSelect): self.new, self.new_message = new, new_message self.source_full = source_full - def get_cols(self): + def get_cols(self, python=False): jq_col_names, extra_cols = [], [] col_labels = {} if hasattr(self.associated_model, self.table_cols + '_LBL'): @@ -557,13 +557,19 @@ class JQueryJqGrid(forms.RadioSelect): field_name += f_name field_verbose_names.append(unicode(field_verbose_name)) if field_name in col_labels: - jq_col_names.append(u'"%s"' % unicode(col_labels[field_name])) + jq_col_names.append(unicode(col_labels[field_name])) else: - jq_col_names.append(u'"%s"' % settings.JOINT.join( + jq_col_names.append(settings.JOINT.join( [f for f in field_verbose_names if f])) - extra_cols.append(self.COL_TPL % {'idx': field_name}) - jq_col_names = jq_col_names and ", ".join(jq_col_names) or "" - extra_cols = extra_cols and ", ".join(extra_cols) or "" + if not python: + jq_col_names[-1] = u'"%s"' % jq_col_names[-1] + if python: + extra_cols.append(field_name) + else: + extra_cols.append(self.COL_TPL % {'idx': field_name}) + if not python: + jq_col_names = jq_col_names and ", ".join(jq_col_names) or "" + extra_cols = extra_cols and ", ".join(extra_cols) or "" return jq_col_names, extra_cols def render(self, name, value=None, attrs=None): -- cgit v1.2.3