Features: 1) Simplify autocomplete list filter by utilizing django.jQuery for bootstrap initialization;
Fixes: 1) Remove redundant external JavaScript includes for autocomplete functionality; Extra: 1) Add minor formatting tweak by inserting a blank line for improved readability.
This commit is contained in:
parent
9b118aacef
commit
efcbfea825
1 changed files with 8 additions and 5 deletions
|
|
@ -1,4 +1,5 @@
|
|||
{% load i18n static %}
|
||||
|
||||
<div class="filter-autocomplete">
|
||||
<select name="{{ spec.lookup_kwarg }}"
|
||||
id="id_{{ spec.lookup_kwarg }}"
|
||||
|
|
@ -16,9 +17,11 @@
|
|||
</select>
|
||||
</div>
|
||||
|
||||
<link rel="stylesheet"
|
||||
href="{% static 'admin/css/autocomplete.css' %}"/>
|
||||
<link rel="stylesheet" href="{% static 'admin/css/autocomplete.css' %}"/>
|
||||
|
||||
<script src="{% static 'admin/js/vendor/jquery/jquery.min.js' %}"></script>
|
||||
<script src="{% static 'admin/js/vendor/select2/select2.full.min.js' %}"></script>
|
||||
<script src="{% static 'admin/js/autocomplete.js' %}"></script>
|
||||
{# Only our own bootstrap script, using django.jQuery #}
|
||||
<script>
|
||||
(function ($) {
|
||||
$('.admin-autocomplete').djangoAdminSelect2();
|
||||
})(django.jQuery);
|
||||
</script>
|
||||
|
|
|
|||
Loading…
Reference in a new issue