summaryrefslogtreecommitdiff
path: root/ishtar_common/widgets.py
diff options
context:
space:
mode:
authorÉtienne Loks <etienne.loks@iggdrasil.net>2017-09-13 10:54:55 +0200
committerÉtienne Loks <etienne.loks@iggdrasil.net>2017-09-13 10:54:55 +0200
commit5717274f9375c60d4f964be5e589b4282f4b1d0f (patch)
tree5160c001794e2771e669345ab776f2a8871455b9 /ishtar_common/widgets.py
parent8dd3261b084f6f35fa4380e3cae9447367a0d083 (diff)
downloadIshtar-5717274f9375c60d4f964be5e589b4282f4b1d0f.tar.bz2
Ishtar-5717274f9375c60d4f964be5e589b4282f4b1d0f.zip
Select2 widget: fix static choices
Diffstat (limited to 'ishtar_common/widgets.py')
-rw-r--r--ishtar_common/widgets.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/ishtar_common/widgets.py b/ishtar_common/widgets.py
index f5d32586c..4efb4c3fb 100644
--- a/ishtar_common/widgets.py
+++ b/ishtar_common/widgets.py
@@ -136,8 +136,11 @@ class Select2Multiple(forms.SelectMultiple):
if self.remote in ('None', 'false'):
# test on lazy object is buggy... so we have this ugly test
self.remote = None
- if not choices and not self.remote and self.model:
- choices = self.get_choices()
+ if not choices:
+ if not self.remote and self.model:
+ choices = self.get_choices()
+ if hasattr(self, 'choices') and self.choices:
+ choices = self.choices
new_attrs = self.attrs.copy()
new_attrs.update(attrs)
attrs = new_attrs