crucialfelix / django-ajax-selects

jQuery UI-powered auto-complete fields for ForeignKey, ManyToMany and text fields
Other
824 stars 248 forks source link

pass {{ extra_attrs }} to autocompleteselectmultiple.html #266

Closed slackarea closed 4 years ago

slackarea commented 4 years ago

in autocompleteselectmultiple.html there is:

<input type="text" name="{{name}}_text" id="{{html_id}}_text" value="" autocomplete="off" {{ extra_attrs }} />

Now, I tried to pass 'placeholder="Some text"' without success .

In my forms.py I have:

... group = AutoCompleteSelectMultipleField('groups', required=False, help_text='', widget={'placeholder': "Test"}) ...

But it doesn't work...

slackarea commented 4 years ago

Finally! I found the solution:

widget_options={'attrs': {'placeholder': 'TEST'}})

it is an example to pass extra_attrs to the HTML template

Thank you!