You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, I wonder if there should be a field for the bootstrap 5 file input, which has changed since bootstrap 4 to not require the use of javascript, it seems (which helps with CSP), and can be presented in two different forms, small, or large.
I currently have a custom field input, as I am importing bootstrap5 but using crispy bootstrap4. It is the bootstrap4 code, only without the javascript, which is now unnecessary.
{% load crispy_forms_field %}
<div class="{{ field_class }} mb-2">
{% for widget in field.subwidgets %}
{% if widget.data.is_initial %}
<div class="input-group mb-2">
<div class="input-group-prepend">
<span class="input-group-text">{{ widget.data.initial_text }}</span>
</div>
<div class="form-control d-flex h-auto">
<span class="text-break" style="flex-grow:1;min-width:0">
<a href="{{ field.value.url }}">{{ path }}</a>
</span>
{% if not widget.data.required %}
<span class="align-self-center ml-2">
<span class="custom-control custom-checkbox">
<input type="checkbox" name="{{ widget.data.checkbox_name }}" id="{{ widget.data.checkbox_id }}" class="custom-control-input"{% if field.field.disabled %} disabled{% endif %} >
<label class="custom-control-label mb-0" for="{{ widget.data.checkbox_id }}">{{ widget.data.clear_checkbox_label }}</label>
</span>
</span>
{% endif %}
</div>
</div>
<div class="input-group mb-0">
{% endif %}
<div class="custom-file{% if field.errors %} is-invalid{%endif%}">
<label class="custom-file-label text-truncate" for="{{ field.id_for_label }}"></label>
<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 %}>
</div>
{% if not widget.data.is_initial %}
{% include 'bootstrap4/layout/help_text_and_errors.html' %}
{% endif %}
{% if widget.data.is_initial %}
</div>
<div class="input-group mb-0">
{% include 'bootstrap4/layout/help_text_and_errors.html' %}
</div>
{% endif %}
{% endfor %}
</div>
I am able to instantiate this custom field currently using the following (note the bootstrap5 form-control-lg):
Hi, I wonder if there should be a field for the bootstrap 5 file input, which has changed since bootstrap 4 to not require the use of javascript, it seems (which helps with CSP), and can be presented in two different forms, small, or large.
https://getbootstrap.com/docs/5.0/forms/form-control/#file-input
I currently have a custom field input, as I am importing bootstrap5 but using crispy bootstrap4. It is the bootstrap4 code, only without the javascript, which is now unnecessary.
I am able to instantiate this custom field currently using the following (note the bootstrap5 form-control-lg):
The text was updated successfully, but these errors were encountered: