From d66686f332337211929ddb505eeab8eff42cd4e4 Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Thu, 30 Jun 2011 14:04:52 +0200 Subject: Manage many to one treatment (refs #499) --- ishtar/ishtar_base/widgets.py | 28 ++++++++++++++++++++++------ 1 file changed, 22 insertions(+), 6 deletions(-) (limited to 'ishtar/ishtar_base/widgets.py') diff --git a/ishtar/ishtar_base/widgets.py b/ishtar/ishtar_base/widgets.py index e058f7074..cb257325c 100644 --- a/ishtar/ishtar_base/widgets.py +++ b/ishtar/ishtar_base/widgets.py @@ -205,13 +205,14 @@ class JQueryJqGrid(forms.RadioSelect): ]} def __init__(self, source, form, associated_model, attrs={}, - table_cols='TABLE_COLS', multiple=False): + table_cols='TABLE_COLS', multiple=False, multiple_cols=[2]): self.source = source self.form = form self.attrs = attrs self.associated_model = associated_model self.table_cols = table_cols self.multiple = multiple + self.multiple_cols = multiple_cols def render(self, name, value=None, attrs=None): t = loader.get_template('form_snippet.html') @@ -259,11 +260,12 @@ class JQueryJqGrid(forms.RadioSelect): dct = {'name':name, 'col_names':col_names, 'extra_cols':extra_cols, 'source':unicode(self.source), 'col_idx':col_idx, 'no_result':unicode(_("No results")), 'loading':unicode(_("Loading...")), - 'remove':unicode(_("Remove")), 'sname':name.replace('-', '')} - + 'remove':unicode(_(u"Remove")), 'sname':name.replace('-', ''), + 'multi_cols': ",".join((u'"%d"' % col for col in self.multiple_cols))} rendered += """