diff options
Diffstat (limited to 'ishtar_common/widgets.py')
| -rw-r--r-- | ishtar_common/widgets.py | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/ishtar_common/widgets.py b/ishtar_common/widgets.py index 85a1d20b1..d4c9d625d 100644 --- a/ishtar_common/widgets.py +++ b/ishtar_common/widgets.py @@ -311,6 +311,13 @@ class Select2Base(Select2Media): except (self.model.DoesNotExist, ValueError): # an old reference? it should not happen pass + if attrs.get("modal", None): + if options: + options = options[:-1] + ", " + else: + options = "{" + modal = attrs['modal'] + options += f" dropdownParent: $('#{modal}')}}" if attrs.get("full-width", None): if options: options = options[:-1] + ", " @@ -401,6 +408,8 @@ class Select2BaseField(object): widget = Select2Multiple else: widget = Select2Simple + if "modal" in kwargs: + attrs["modal"] = kwargs.pop("modal") if kwargs.get("style", None): attrs["style"] = kwargs.pop("style") kwargs["widget"] = widget( @@ -410,7 +419,7 @@ class Select2BaseField(object): new=new, attrs=attrs, ) - super(Select2BaseField, self).__init__(*args, **kwargs) + super().__init__(*args, **kwargs) def get_q(self): q = self.model.objects |
