#14370: Adding support for Autocomplete in contrib.admin -------------------------------------+------------------------------------- Reporter: tyrion | Owner: nobody Type: New feature | Status: new Component: contrib.admin | Version: master Severity: Normal | Resolution: Keywords: autocomplete, | Triage Stage: Accepted jquery, javascript, widgets, | admin | Has patch: 1 | Needs documentation: 1 Needs tests: 0 | Patch needs improvement: 1 Easy pickings: 0 | UI/UX: 1 -------------------------------------+-------------------------------------
Comment (by collinanderson): '''why select2 ?''' It seems like a popular and mature library. I have to admit I've never used an autocomplete library before so I'm a bit of an imposter here. :) I'm a little scared that it just got major breaking changes. What would you use? jQuery UI? Typeahead? '''changing the default''' It's opt-in. You have to specify `ajax_autocomplete = ['user']` or maybe you'll have to use `formfield_overrides`. 3rd-parties could re-use the backend view. '''vendoring / distributing with django''' I think it's a necessary evil. I'm a little scared that we went from vendoring just jQuery to including xregexp and Roboto in just 6 months. The native html5 `datalist` doesn't seem good enough for the job, and I tried hand-writing autocomplete javascript in django and quickly realized a dependency is a must. Currently vendoring is the only option for django, and it's a reasonable size (slightly smaller than jQuery, 80k vs 84k). I see this as the main hurdle to getting this merged. We would need to run it by the DevelopersMailingList for sure. '''reusing django-select2''' I think the widget code in django-select2 is much better than what I have, and of course django-select2 actually has tests. I'd be interested in re-using those. I'm a bit worried about the backend code. Currently I'm trying to implement this as similar to raw_id_fields as possible. If we reuse the admin code we get permissions, to_field, limit_choices_to, search, get_queryset, urls, etc for free. What would it take to add the missing features to django-select2? '''next steps''' I mostly made this pull request as a discussion starter and to show what I think is a good way forward. I don't actually have the energy right now to push this to completion, but I'd help review pull requests. -- Ticket URL: <https://code.djangoproject.com/ticket/14370#comment:36> Django <https://code.djangoproject.com/> The Web framework for perfectionists with deadlines. -- You received this message because you are subscribed to the Google Groups "Django updates" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-updates+unsubscr...@googlegroups.com. To post to this group, send email to django-updates@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/064.fae7c4914b460e4b9606a5c456370100%40djangoproject.com. For more options, visit https://groups.google.com/d/optout.