summaryrefslogtreecommitdiff
path: root/ishtar_common/widgets.py
diff options
context:
space:
mode:
authorÉtienne Loks <etienne.loks@iggdrasil.net>2026-01-20 16:26:07 +0100
committerÉtienne Loks <etienne.loks@iggdrasil.net>2026-01-20 17:28:08 +0100
commit0e14b5b78ecf1af4f1473017c7d84b0583a05962 (patch)
tree00945ffabad8b49b4f0ef64849a748f259fc5a92 /ishtar_common/widgets.py
parentef281a21d74ef694a9bfb92fc3f61ce744af5f2a (diff)
downloadIshtar-0e14b5b78ecf1af4f1473017c7d84b0583a05962.tar.bz2
Ishtar-0e14b5b78ecf1af4f1473017c7d84b0583a05962.zip
💄 dating form: select2 (autocompletion) widget for period (refs #6566)
Diffstat (limited to 'ishtar_common/widgets.py')
-rw-r--r--ishtar_common/widgets.py11
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