3 ms·
It was a few years ago that I used it but I found django-autocomplete-light pretty unfriendly and not very light. It was far easier to roll my own.
by collyw 9y ago
It was a few years ago that I used it but I found django-autocomplete-light pretty unfriendly and not very light. It was far easier to roll my own.
- spapas82 9y agoHello, 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!