Closes #17944: Allow filtering of ObjectVar and MultiObjectVar script inputs (#18725)

* Add the advanced object selector to the ObjectVar and MultiObjectVar script inputs

* Fix formatting issue
This commit is contained in:
atownson
2025-03-03 08:20:04 -06:00
committed by GitHub
parent 127656cf87
commit 8a38f095cc
3 changed files with 9 additions and 1 deletions

View File

@@ -211,10 +211,12 @@ class ObjectVar(ScriptVariable):
:param context: A custom dictionary mapping template context variables to fields, used when rendering <option>
elements within the dropdown menu (optional)
:param null_option: The label to use as a "null" selection option (optional)
:param selector: Include an advanced object selection widget to assist the user in identifying the desired
object (optional)
"""
form_field = DynamicModelChoiceField
def __init__(self, model, query_params=None, context=None, null_option=None, *args, **kwargs):
def __init__(self, model, query_params=None, context=None, null_option=None, selector=False, *args, **kwargs):
super().__init__(*args, **kwargs)
self.field_attrs.update({
@@ -222,6 +224,7 @@ class ObjectVar(ScriptVariable):
'query_params': query_params,
'context': context,
'null_option': null_option,
'selector': selector,
})

View File

@@ -54,3 +54,7 @@
</div>
</div>
{% endblock content %}
{% block modals %}
{% include 'inc/htmx_modal.html' with size='lg' %}
{% endblock %}