Closed
Description
Thanks for the package, it was really quick to set up.
It took me a bit of time (say 1h) to understand how to customize the placeholder
& minimumInputLength
options, without having to do any select2 javascript (and what I tried didn't work in any case).
I ended up finding the solution in an issue on the previous repo, and thought I could share it for future reference. And maybe add it to the documentation/examples somewhere ?
class MyForm(forms.Form):
my_choice = forms.ModelMultipleChoiceField(
widget=ModelSelect2MultipleWidget(
model=MyOtherModel,
search_fields=['title__icontains'],
attrs={
'data-placeholder': 'Custom placeholder', // was empty
'data-minimum-input-length': 0 // was 2
}
)
)