Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 0 additions & 9 deletions crispy_bootstrap4/templates/bootstrap4/layout/field_file.html
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,6 @@
<div class="form-control custom-file{% if field.errors %} is-invalid{%endif%}" style="border:0">
<input type="{{ widget.data.type }}" name="{{ widget.data.name }}" class="custom-file-input{% if widget.data.attrs.class %} {{ widget.data.attrs.class }}{% endif %}{% if field.errors %} is-invalid{%endif%}"{% if field.field.disabled %} disabled{% endif %}{% for name, value in widget.data.attrs.items %}{% if value is not False and name != 'class' %} {{ name }}{% if value is not True %}="{{ value|stringformat:'s' }}"{% endif %}{% endif %}{% endfor %}>
<label class="custom-file-label text-truncate" for="{{ field.id_for_label }}">---</label>
<script type="text/javascript" id="script-{{ field.id_for_label }}">
document.getElementById("script-{{ field.id_for_label }}").parentNode.querySelector('.custom-file-input').onchange = function (e){
var filenames = "";
for (let i=0;i<e.target.files.length;i++){
filenames+=(i>0?", ":"")+e.target.files[i].name;
}
e.target.parentNode.querySelector('.custom-file-label').textContent=filenames;
}
</script>
</div>
{% if not widget.data.is_initial %}
{% include 'bootstrap4/layout/help_text_and_errors.html' %}
Expand Down