django-autocomplete-light
django-autocomplete-light copied to clipboard
[question] - How to enable multiple select in dropdown for autocomplete_light.MultipleChoiceField
Hi, I'm using autocomplete_light.MultipleChoiceField for multiple choice field. I'm able to get dropdown populated with values and for each value i need to enter the text and select values. If I need to select 10 values from the drop down i need to type 10 times. Is there a way to enable/allow multiple select from download so that user needn't type in the regex in search field 10 times?
class HostGroupModelForm( autocomplete_light.ModelForm ): hosts=autocomplete_light.MultipleChoiceField('HostAutocomplete')
class HostAutocomplete( autocomplete_light.AutocompleteModelBase ): search_fields = [ 'hostname' ] limit_choices = 75 choices = Host.objects.all()
In DAL v3, you could probably do that with select:closing
DOM event.
How can it be achieved in 2.2.6?
It would be good if user can select multiple items from dropdown by pressing control key. Is there a way to achieve this?
There's always a way ;) Just override the right function in the script.
Is there any update of this? In 3.5.1
Example:
class XXXForm(ModelForm):
xxxxuser = MultipleChoiceField(
choices=[],
widget= autocomplete.ListSelect2(
url='user_autocomplete',
attrs={
'data-html': True ,
'data-placeholder': 'Find user',
'multiple': True
}
)
)
Is there a way to select one element multiple times from dropdown?