#14370: Adding support for Autocomplete in contrib.admin
-------------------------------------+-------------------------------------
Reporter: Germano Gabbianelli | Owner: Johannes
| Hoppe
Type: New feature | Status: assigned
Component: contrib.admin | Version: master
Severity: Normal | Resolution:
Keywords: autocomplete, | Triage Stage: Accepted
jquery, javascript, widgets, |
admin |
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1
Easy pickings: 0 | UI/UX: 1
-------------------------------------+-------------------------------------
Comment (by James Pic):
This is the code that does the trick for me: https://github.com/yourlabs
/django-autocomplete-
light/blob/master/src/dal_select2/static/autocomplete_light/select2.js#L91-L97
{{{
// Remove this block when this is merged upstream:
// https://github.com/select2/select2/pull/4249
$(document).on('DOMSubtreeModified', '[data-autocomplete-light-
function=select2] option', function() {
$(this).parents('select').next().find(
'.select2-selection--single .select2-selection__rendered'
).text($(this).text());
});
}}}
Just replace `[data-autocomplete-light-function=select2]` by your own
select tag selector and you should be good to go.
However, it was meant as a temporary fix even for DAL, so I'm not sure if
this is of any help to you. I would suggest to add a breakpoint somewhere
in the code that Kevin's patch adds or changes and hopefully if it's
executed at all then the solution should be easy to find.
--
Ticket URL: <https://code.djangoproject.com/ticket/14370#comment:61>
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 [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/064.df11953dabe5888ab682d7085446b877%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.