{%- set value = field.clean_value -%}
<div class="init-block filedropwidget{% if widget.classname %} {{ widget.classname }}{% endif %}"
     data-input-name="{{ field.input_name }}"
     id='id_{{field.input_name}}'
     data-block-name="dropfile"
     data-url="{{ field.upload_url }}"
     {%- if value %} data-current-file="{{ value.url }}"{% endif %}
     {%- if readonly %} data-disabled="disabled"{% endif %}
     {% block extra_js_options %}{% endblock %}>

  {% if not readonly and value and not field.conv.required %}
    <button type="button" class="button w-button ajax-file-delete">удалить</button>
    <br/>
  {% endif %}

  {%- block before_filedata %}{% endblock -%}
  <div class="file_data">
      {{ field.get_field('mode').widget.render()|safe }}
      {{ field.get_field('transient_name').widget.render()|safe }}
      {{ field.get_field('original_name').widget.render()|safe }}
      {% if value %}
        <a target="_blank" href="{{ value.url }}">
          {% if value.mode == 'existing' %}
              Прикреплённый файл{% if value.ext %} ({{ value.ext }}){% endif %}
          {% else %}
              Временный загруженный файл
          {% endif %}
        </a>
      {% endif %}
  </div>

  {{- field.get_field('file').widget.render()|safe }}
</div>


