{% include 'django/forms/widgets/input.html' %}
{% if related_url %}
  <div class="input-group">
    <span id="{{ widget.attrs.id }}_lookup_text" class="form-control related-lookup-title">
      {% if link_label %}
        {% if link_url %}<a href="{{ link_url }}" target="_blank">{% endif %}
        {{ link_label }}
        {% if link_url %}
          </a>
        {% endif %}
      {% endif %}
    </span>
    <div class="input-group-append">
      <span class="btn btn-outline-secondary" {% if not widget.value %}style="display: none"{% endif %}
            data-clean-for="{{ widget.attrs.id }}">
        <i class="fa fa-times"></i>
      </span>
      <a href="{{ related_url }}" class="btn btn-outline-secondary js-related-lookup"
         data-related-for="{{ widget.attrs.id }}" id="lookup_id_{{ widget.name }}">
        <span class="fa fa-search"></span>
      </a>
    </div>
  </div>
{% endif %}