diff options
author | Étienne Loks <etienne.loks@iggdrasil.net> | 2019-06-04 17:28:44 +0200 |
---|---|---|
committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2019-06-04 17:28:44 +0200 |
commit | daee77bd657f0e72767d64dd92f36008e1c47676 (patch) | |
tree | 1faf126fd84566f09901a694c144626e0c0df4ce /ishtar_common/forms.py | |
parent | d7e26ad68e62014d1fbe01c36b0bd1d5688181c2 (diff) | |
download | Ishtar-daee77bd657f0e72767d64dd92f36008e1c47676.tar.bz2 Ishtar-daee77bd657f0e72767d64dd92f36008e1c47676.zip |
QA operation: bulk modification
Diffstat (limited to 'ishtar_common/forms.py')
-rw-r--r-- | ishtar_common/forms.py | 11 |
1 files changed, 8 insertions, 3 deletions
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)) |