Answer the question
In order to leave comments, you need to log in
Select2 not working in Django. What to do?
Hello.
Can't apply Select2 autocomplete selector in my form in Django.
It seems that I do everything according to the instructions :
installed django_select2;
added to INSTALLED_APP;
added path('select2/', include('django_select2.urls')),
to urls;
added import to forms.py:
from django_select2.forms import Select2Widget, Select2MultipleWidget
class Meta
for forms.ModelForm
addedwidgets = {
'mat_div_id': Select2Widget,
'mat_speaker_id': Select2MultipleWidget,
}
{{ form.media.css }}
in {% block extrahead %}
, {{ form.media.js }}
- before {% endblock content %}
. jquery
to INSTALLED_APP and wrote<script type="text/javascript" src="/static/js/jquery.js"></script>
in the base template. Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question