diff --git a/crispy_bootstrap5/templates/bootstrap5/layout/prepended_appended_text.html b/crispy_bootstrap5/templates/bootstrap5/layout/prepended_appended_text.html index a48f9af..f819438 100644 --- a/crispy_bootstrap5/templates/bootstrap5/layout/prepended_appended_text.html +++ b/crispy_bootstrap5/templates/bootstrap5/layout/prepended_appended_text.html @@ -6,7 +6,7 @@ <div id="div_{{ field.auto_id }}" class="mb-3{% if wrapper_class %} {{ wrapper_class }}{% endif %}{% if 'form-horizontal' in form_class %} row{% endif %}{% if form_group_wrapper_class %} {{ form_group_wrapper_class }}{% endif %}{% if form_show_errors and field.errors %} has-danger{% endif %}{% if field.css_classes %} {{ field.css_classes }}{% endif %}"> {% if field.label and form_show_labels %} - <label for="{{ field.id_for_label }}" class="{% if 'form-horizontal' in form_class %}col-form-label {% else %}form-label{% endif %}{{ label_class }}{% if field.field.required %} requiredField{% endif %}"> + <label for="{{ field.id_for_label }}" class="{% if 'form-horizontal' in form_class %}col-form-label{% else %}form-label{% endif %} {{ label_class }}{% if field.field.required %} requiredField{% endif %}"> {{ field.label }}{% if field.field.required %}<span class="asteriskField">*</span>{% endif %} </label> {% endif %} diff --git a/tests/results/test_prepended_appended_text.html b/tests/results/test_prepended_appended_text.html index 008c1e1..94cca0a 100644 --- a/tests/results/test_prepended_appended_text.html +++ b/tests/results/test_prepended_appended_text.html @@ -1,5 +1,5 @@ <form method="post"> - <div class="mb-3" id="div_id_email"><label class="form-label requiredField" for="id_email">email<span + <div class="mb-3" id="div_id_email"><label class="my-label form-label requiredField" for="id_email">email<span class="asteriskField">*</span></label> <div> <div class="input-group"><span class="input-group-text">@<>&</span><input aria-describedby="id_email_helptext" @@ -8,14 +8,14 @@ class="form-text" id="id_email_helptext">Insert your email</div> </div> </div> - <div class="mb-3" id="div_id_password1"><label class="form-label requiredField" for="id_password1">password<span + <div class="mb-3" id="div_id_password1"><label class="my-label form-label requiredField" for="id_password1">password<span class="asteriskField">*</span></label> <div> <div class="input-group"><input class="form-control textInput textinput" id="id_password1" maxlength="30" name="password1" required type="password"><span class="input-group-text">#</span></div> </div> </div> - <div class="mb-3" id="div_id_password2"><label class="form-label requiredField" for="id_password2">re-enter + <div class="mb-3" id="div_id_password2"><label class="my-label form-label requiredField" for="id_password2">re-enter password<span class="asteriskField">*</span></label> <div > <div class="input-group"><span class="input-group-text">$</span><input @@ -23,4 +23,4 @@ type="password"></div> </div> </div> -</form> \ No newline at end of file +</form> diff --git a/tests/results/test_prepended_appended_text_lt50.html b/tests/results/test_prepended_appended_text_lt50.html index dddf352..222dadf 100644 --- a/tests/results/test_prepended_appended_text_lt50.html +++ b/tests/results/test_prepended_appended_text_lt50.html @@ -1,5 +1,5 @@ <form method="post"> - <div class="mb-3" id="div_id_email"><label class="form-label requiredField" for="id_email">email<span + <div class="mb-3" id="div_id_email"><label class="my-label form-label requiredField" for="id_email">email<span class="asteriskField">*</span></label> <div> <div class="input-group"><span class="input-group-text">@<>&</span><input @@ -8,14 +8,14 @@ class="form-text" id="id_email_helptext">Insert your email</div> </div> </div> - <div class="mb-3" id="div_id_password1"><label class="form-label requiredField" for="id_password1">password<span + <div class="mb-3" id="div_id_password1"><label class="my-label form-label requiredField" for="id_password1">password<span class="asteriskField">*</span></label> <div> <div class="input-group"><input class="form-control textInput textinput" id="id_password1" maxlength="30" name="password1" required type="password"><span class="input-group-text">#</span></div> </div> </div> - <div class="mb-3" id="div_id_password2"><label class="form-label requiredField" for="id_password2">re-enter + <div class="mb-3" id="div_id_password2"><label class="my-label form-label requiredField" for="id_password2">re-enter password<span class="asteriskField">*</span></label> <div > <div class="input-group"><span class="input-group-text">$</span><input @@ -23,4 +23,4 @@ type="password"></div> </div> </div> -</form> \ No newline at end of file +</form> diff --git a/tests/test_layout_objects.py b/tests/test_layout_objects.py index 6f3cdbf..93c6a33 100644 --- a/tests/test_layout_objects.py +++ b/tests/test_layout_objects.py @@ -215,6 +215,7 @@ def test_custom_django_widget(self): def test_prepended_appended_text(self): test_form = SampleForm() test_form.helper = FormHelper() + test_form.helper.label_class = "my-label" test_form.helper.layout = Layout( PrependedAppendedText( "email", "@<>&", "gmail.com", css_class="form-control-lg"