<!--
    Bloomerp File Field Widget
-->
<div id="{{widget.name}}_view_div" {% if invalid %}class="is-invalid"{% endif %}>
    <input type="{{ widget.type }}" name="{{ widget.name }}"{% include "django/forms/widgets/attrs.html" %}>

    {% if widget.is_initial %}
        {{ widget.initial_text }}: 
            <a href="{{ widget.value.url }}">{{ widget.value }}</a>
        {% if not widget.required %}
            <input 
                type="checkbox" name="{{ widget.checkbox_name }}" id="{{ widget.checkbox_id }}"
                {% if widget.attrs.disabled %} disabled{% endif %}
                {% if widget.attrs.checked %} checked{% endif %}
            >
            <label for="{{ widget.checkbox_id }}">{{ widget.clear_checkbox_label }}</label>
        {% endif %}
    <br>
    {% endif %}
    {% if current_file %}
    <!--In this case the file object already exits-->
    <input 
        type="hidden" 
        value="{{ current_file.pk}}" 
        name="{{ widget.name }}_current"
    />
    {% endif %}
</div>