From daa8d5562ffcab11df290bf7101b2e3fe266b674 Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Tue, 4 Jun 2019 17:28:44 +0200 Subject: QA operation: bulk modification --- ishtar_common/forms.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'ishtar_common/forms.py') diff --git a/ishtar_common/forms.py b/ishtar_common/forms.py index c7e3fe38c..cfdd531d9 100644 --- a/ishtar_common/forms.py +++ b/ishtar_common/forms.py @@ -824,10 +824,15 @@ class QAForm(CustomForm, ManageOldType): elif hasattr(self.fields[k], "choices"): values = [] for v in kwargs['data'].getlist(k): - dct_choices = dict(self.fields[k].choices) - if v in dct_choices: + dct_choices = {} + for key, value in self.fields[k].choices: + if isinstance(value, (list, tuple)): + dct_choices.update(value) + else: + dct_choices[key] = value + if v in list(dct_choices.keys()): values.append(unicode(dct_choices[v])) - elif int(v) in dct_choices: + elif int(v) in list(dct_choices.keys()): values.append(unicode(dct_choices[int(v)])) self.fields[k].rendered_value = mark_safe( u" ; ".join(values)) -- cgit v1.2.3