Wrote autocompletion for foreign key field

This commit is contained in:
2022-01-01 17:18:08 +01:00
parent 563a769064
commit f21ce223bc
8 changed files with 133 additions and 69 deletions

View File

@@ -1,5 +1,5 @@
<div class="dropdown">
<input autocomplete="off" id="{{widget.attrs.id}}" data-ac-url="{{custom.search_url}}" data-bs-toggle="dropdown" type="text" placeholder="Search..." class="{{widget.attrs.class}}">
<input autocomplete="off" id="{{widget.attrs.id}}" data-ac-url="{{custom.search_url}}" data-ac-name-field="{{custom.name_field_name}}" {% if custom.image_field_name %}data-ac-image-field="{{custom.image_field_name}}"{% endif %} data-bs-toggle="dropdown" type="text" placeholder="Search..." class="{{widget.attrs.class}}">
<ul id="{{widget.attrs.id}}-ac-ul" class="dropdown-menu">
</ul>
<div class="d-flex align-items-center mt-3 mb-3" id="{{widget.attrs.id}}-dflex-container">
@@ -17,7 +17,7 @@
{% endif %}
<div class="ms-3">
{% if custom.current_instance %}
{{custom.current_instance}}
{{custom.name}}
{% else %}
<span class="text-secondary">None selected</span>
{% endif %}