diff options
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 |
commit | 35209dc15d2c7a43b56d15ad0004d5e5281edddb (patch) | |
tree | 5160c001794e2771e669345ab776f2a8871455b9 /ishtar_common/widgets.py | |
parent | 88a469a70270d0a886f02ad213087b71384ae78e (diff) | |
download | Ishtar-35209dc15d2c7a43b56d15ad0004d5e5281edddb.tar.bz2 Ishtar-35209dc15d2c7a43b56d15ad0004d5e5281edddb.zip |
Select2 widget: fix static choices
Diffstat (limited to 'ishtar_common/widgets.py')
-rw-r--r-- | ishtar_common/widgets.py | 7 |
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 |