3 ms·
Hello, I agree that previous versions of django-autocomplete-light were cumbersome to use. However, since version 3 most of the magic has gone away: 1. Add a c
by spapas82 9y ago
Hello, I agree that previous versions of django-autocomplete-light were cumbersome to use. However, since version 3 most of the magic has gone away:
1. Add a class-based-view that returns the search data (inheriting from autocomplete.Select2QuerySetView)
2. Register that view with your urls.py as normally (but be sure to give it a name)
3. Add a form field by specifying its widget using the autocomplete.ModelSelect2 widgt, passing it a url='view-name' parameter (which is the view name you used in 2).
4. Don't forget to include jquery and {{ form.media }} in the views that uses your autocomplete.
5. Done!
Seems pretty easy and friendly to me!