summaryrefslogtreecommitdiff
path: root/ishtar_common/forms.py
diff options
context:
space:
mode:
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
commitdaa8d5562ffcab11df290bf7101b2e3fe266b674 (patch)
tree1faf126fd84566f09901a694c144626e0c0df4ce /ishtar_common/forms.py
parent5a82808c2fa33fdcec7d07b40b455feb645ade84 (diff)
downloadIshtar-daa8d5562ffcab11df290bf7101b2e3fe266b674.tar.bz2
Ishtar-daa8d5562ffcab11df290bf7101b2e3fe266b674.zip
QA operation: bulk modification
Diffstat (limited to 'ishtar_common/forms.py')
-rw-r--r--ishtar_common/forms.py11
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))