shimatta-kenkyusho/shimatta_kenkyusho/templates/widgets/autocomplete-foreign-key.html

27 lines
1.2 KiB
HTML

<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}}">
<ul id="{{widget.attrs.id}}-ac-ul" class="dropdown-menu">
</ul>
<div class="d-flex align-items-center" id="{{widget.attrs.id}}-dflex-container">
{% if custom.current_instance %}
{% if custom.image_field_name %}
<div class="flex-shrink-0">
{% if custom.image %}
<img src="{{custom.image.url}}" style="max-width:64px;max-height:64px;" class="mr-3">
{% else %}
{% load static %}
<img src="{% static 'css/icons/card-image.svg' %}" style="width:64px;max-height:64px;" class="mr-3">
{% endif %}
</div>
{% endif %}
{% endif %}
<div class="flex-grow-1 ms-3">
{% if custom.current_instance %}
{{custom.current_instance}}
{% else %}
<span class="text-secondary">None selected</span>
{% endif %}
</div>
</div>
<input type="hidden" {% if widget.value != None %}value="{{widget.value}}"{%endif%} name={{widget.name}}>
</div>