-
Hi, I'm attempting to integrate django-select2 into my django page for a select box that has very few items. Because of this, I wish to show all the items without having to enter something into the search box. With the normal select2 lib, I understood it can be done using options 'minimumInputLength' and 'minimumResultsForSearch', but with django-select2 I cannot get it to work. Where should I use these options with this library, or if not supported, how can I achieve the described behaviour? Here is my sample # forms.py
class MySubObjectWidget(s2forms.ModelSelect2MultipleWidget):
search_fields = [
"name__icontains",
]
class MyForm(forms.ModelForm):
class Meta:
model = models.Object1
fields = "__all__"
widgets = {
"subObjectList": MySubObjectWidget(),
}
# views.py
class Object1CreateView(CreateView):
model = Object1
form_class = forms.MyForm
success_url = "/" Thanks. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
You can pass |
Beta Was this translation helpful? Give feedback.
You can pass
data-minimum-input-length
as anattr
to the widget.