Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix AppendedText label class (#184) #185

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
Expand Up @@ -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 %}
Expand Down
8 changes: 4 additions & 4 deletions tests/results/test_prepended_appended_text.html
Original file line number Diff line number Diff line change
@@ -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">@&lt;&gt;&amp;</span><input aria-describedby="id_email_helptext"
Expand All @@ -8,19 +8,19 @@
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
class="form-control textInput textinput" id="id_password2" maxlength="30" name="password2" required
type="password"></div>
</div>
</div>
</form>
</form>
8 changes: 4 additions & 4 deletions tests/results/test_prepended_appended_text_lt50.html
Original file line number Diff line number Diff line change
@@ -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">@&lt;&gt;&amp;</span><input
Expand All @@ -8,19 +8,19 @@
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
class="form-control textInput textinput" id="id_password2" maxlength="30" name="password2" required
type="password"></div>
</div>
</div>
</form>
</form>
1 change: 1 addition & 0 deletions tests/test_layout_objects.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
Loading