Closed psk007 closed 4 years ago
Hi @psk007,
thanks for reaching out. Select 2 supports setting the AJAX URL, among other things, via data-attributes, see also https://select2.org/configuration/data-attributes
Everything should work fine, by default. The only thing I can think of, is that you are using a very old version of jQuery. Can you maybe send me some information about your stack? jQuery version, Select2 version, Django version, etc?
Best -Joe
Hi dear , Thanks for your response . My problem was resolved by your guide . The stack information are below:
Django : 3.0.3
Select2 : 4.0.6 (full js vesion)
JQuery : 3.2.1
So i upgrade select2 to latest version (4.0.13) and the problem was solved 😁.
Perfect, if you have any suggestions on how to improve the documentation, please let me know.
Goal Ajax URL is not used in my AJAX submits. Problem I have a problem with django_select2.js config file. I create a
ModelForm
and usedModelSelect2Widget
in my form and after rendering form in template everything works correct. But when I want to search something in my select2 box, Ajax request for gettingQuerySet
isn't passed toAutoResponseView
and passed to my current view URL. I checked the form elements in the template and found that the elements had the correct Ajax address. Code SnippetI checked the js config file for a django_select2 and found no URL for the Ajax in the initHeavy function. I tried to experiment with it myself and after that the problem was resolved. But it's not right and I want to know if there is any other solution?