Features: 1) Simplify autocomplete_list_filter.html template by removing unused static assets and unnecessary label tag; 2) Refactor indentation for better readability;
Fixes: None; Extra: Streamline template code by removing redundant HTML elements and unused script imports;
This commit is contained in:
parent
306f54b4a2
commit
f15897f20d
1 changed files with 13 additions and 23 deletions
|
|
@ -1,27 +1,17 @@
|
|||
{% load i18n static %}
|
||||
{% load i18n %}
|
||||
<div class="filter-autocomplete">
|
||||
<label for="id_{{ spec.lookup_kwarg }}"></label><select name="{{ spec.lookup_kwarg }}"
|
||||
id="id_{{ spec.lookup_kwarg }}"
|
||||
class="admin-autocomplete"
|
||||
style="width:90%;"
|
||||
data-ajax--url="{{ spec.autocomplete_url }}"
|
||||
data-app-label="{{ spec.app_label }}"
|
||||
data-model-name="{{ spec.model_name }}"
|
||||
data-field-name="{{ spec.field_name }}"
|
||||
data-allow-clear="true"
|
||||
data-placeholder="{% blocktrans with label=spec.field_label %}Search by {{ label }}…{% endblocktrans %}">
|
||||
<select name="{{ spec.lookup_kwarg }}"
|
||||
id="id_{{ spec.lookup_kwarg }}"
|
||||
class="admin-autocomplete"
|
||||
style="width:90%;"
|
||||
data-ajax--url="{{ spec.autocomplete_url }}"
|
||||
data-app-label="{{ spec.app_label }}"
|
||||
data-model-name="{{ spec.model_name }}"
|
||||
data-field-name="{{ spec.field_name }}"
|
||||
data-allow-clear="true"
|
||||
data-placeholder="{% blocktrans with label=spec.field_label %}Search by {{ label }}…{% endblocktrans %}">
|
||||
{% if spec.lookup_val %}
|
||||
<option value="{{ spec.lookup_val }}" selected>{{ spec.initial_text }}</option>
|
||||
<option value="{{ spec.lookup_val }}" selected>{{ spec.initial_text }}</option>
|
||||
{% endif %}
|
||||
</select>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<link rel="stylesheet"
|
||||
href="{% static 'admin/css/vendor/select2/select2.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/jquery.init.js' %}"></script>
|
||||
<script src="{% static 'admin/js/autocomplete.js' %}"></script>
|
||||
|
|
|
|||
Loading…
Reference in a new issue