From 5717274f9375c60d4f964be5e589b4282f4b1d0f Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Wed, 13 Sep 2017 10:54:55 +0200 Subject: Select2 widget: fix static choices --- ishtar_common/widgets.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'ishtar_common/widgets.py') 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 -- cgit v1.2.3