summaryrefslogtreecommitdiff
path: root/ishtar_common
diff options
context:
space:
mode:
authorÉtienne Loks <etienne.loks@iggdrasil.net>2017-03-29 20:15:43 +0200
committerÉtienne Loks <etienne.loks@iggdrasil.net>2017-03-29 20:15:43 +0200
commit0467ab45a66c3d452dc9b1702fc2b9c6736c7c75 (patch)
tree055d8c6ec436b1b5219cd09e32376cca52ad1768 /ishtar_common
parente1ec2cc7a72a502f9c8cb42b571bdadcad003237 (diff)
downloadIshtar-0467ab45a66c3d452dc9b1702fc2b9c6736c7c75.tar.bz2
Ishtar-0467ab45a66c3d452dc9b1702fc2b9c6736c7c75.zip
Widget: fix Select2Multiple initialization with string
Diffstat (limited to 'ishtar_common')
-rw-r--r--ishtar_common/widgets.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/ishtar_common/widgets.py b/ishtar_common/widgets.py
index f0e1dc775..94709406c 100644
--- a/ishtar_common/widgets.py
+++ b/ishtar_common/widgets.py
@@ -112,10 +112,12 @@ class Select2Multiple(forms.SelectMultiple):
}""" % self.remote
if value:
choices = []
+ if type(value) not in (list, tuple):
+ value = value.split(',')
for v in value:
try:
choices.append((v, self.model.objects.get(pk=v)))
- except self.model.DoesNotExist:
+ except (self.model.DoesNotExist, ValueError):
# an old reference ? it should not happen
pass
html = super(Select2Multiple, self).render(name, value, attrs,