From 2d637b607bbd8459b8a279ef81081a091d54628f Mon Sep 17 00:00:00 2001 From: bryan brancotte <bryan.brancotte@pasteur.fr> Date: Tue, 17 Sep 2024 16:02:03 +0200 Subject: [PATCH] Remove script tag --- .../templates/bootstrap4/layout/field_file.html | 9 --------- 1 file changed, 9 deletions(-) diff --git a/crispy_bootstrap4/templates/bootstrap4/layout/field_file.html b/crispy_bootstrap4/templates/bootstrap4/layout/field_file.html index a363f37..60e25f7 100644 --- a/crispy_bootstrap4/templates/bootstrap4/layout/field_file.html +++ b/crispy_bootstrap4/templates/bootstrap4/layout/field_file.html @@ -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' %}