#28871: Autocomplete select for new lines in inline model do not open
-------------------------------------+-------------------------------------
Reporter: Marcus Götling | Owner: Johannes
| Hoppe
Type: Bug | Status: assigned
Component: contrib.admin | Version: 2.0
Severity: Release blocker | Resolution:
Keywords: autocomplete | Triage Stage: Accepted
select2 |
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 1
-------------------------------------+-------------------------------------
Comment (by Tim Graham):
I found that this patch will allow the "Add another" autocomplete widgets
to work, except for the first one that's added.
{{{ #!diff
diff --git a/django/contrib/admin/static/admin/js/autocomplete.js
b/django/contr
index 15321f9..2fa1920 100644
--- a/django/contrib/admin/static/admin/js/autocomplete.js
+++ b/django/contrib/admin/static/admin/js/autocomplete.js
@@ -29,10 +29,7 @@
$(document).on('formset:added', (function() {
return function(event, $newFormset) {
- var $widget = $newFormset.find('.admin-autocomplete');
- // Exclude already initialized Select2 inputs.
- $widget = $widget.not('.select2-hidden-accessible');
- return init($widget);
+ return $newFormset.find('.admin-
autocomplete').djangoAdminSelect2()
};
})(this));
}(django.jQuery));
}}}
It looks like the contents of `$newFormset` for the first "add another" is
different from the contents of subsequent "add anothers".
--
Ticket URL: <https://code.djangoproject.com/ticket/28871#comment:5>
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/065.bf1d96138705825df20df9229bdde2e8%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.