Skip to content
Merged
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
## Next Release

* Added support for Python 3.13.
* Changed `id` for help text to align with aria-describedby attribute added by Django 5.0+.

## 2024.10 (2024-10-05)

Expand Down
4 changes: 2 additions & 2 deletions crispy_bootstrap4/templates/bootstrap4/layout/help_text.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{% if field.help_text %}
{% if help_text_inline %}
<span id="hint_{{ field.auto_id }}" class="text-muted">{{ field.help_text|safe }}</span>
<span id="{{ field.auto_id }}_helptext" class="text-muted">{{ field.help_text|safe }}</span>
{% else %}
<small id="hint_{{ field.auto_id }}" class="form-text text-muted">{{ field.help_text|safe }}</small>
<small id="{{ field.auto_id }}_helptext" class="form-text text-muted">{{ field.help_text|safe }}</small>
{% endif %}
{% endif %}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
class="textinput textInput inputtext form-control is-invalid" required id="id_email" />
<div class="input-group-append"><span class="input-group-text">whatever</span></div>
</div>
<small id="hint_id_email" class="form-text text-muted">Insert your email</small>
<small id="id_email_helptext" class="form-text text-muted">Insert your email</small>
</div>
</div>
<div id="div_id_first_name" class="form-group">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<input type="text" name="email" value="invalidemail" maxlength="30" class="textinput textInput inputtext form-control is-invalid" required id="id_email" />
<div class="input-group-append"><span class="input-group-text">whatever</span></div>
</div>
<small id="hint_id_email" class="form-text text-muted">Insert your email</small>
<small id="id_email_helptext" class="form-text text-muted">Insert your email</small>
</div>
</div>
<div id="div_id_first_name" class="form-group">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<div class="input-group-append"><span class="input-group-text">whatever</span></div>
<span id="error_1_id_email" class="invalid-feedback"><strong>Enter a valid email address.</strong></span>
</div>
<small id="hint_id_email" class="form-text text-muted">Insert your email</small>
<small id="id_email_helptext" class="form-text text-muted">Insert your email</small>
</div>
</div>
<div id="div_id_first_name" class="form-group">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<div class="input-group-append"><span class="input-group-text">whatever</span></div>
<span id="error_1_id_email" class="invalid-feedback"><strong>Enter a valid email address.</strong></span>
</div>
<small id="hint_id_email" class="form-text text-muted">Insert your email</small>
<small id="id_email_helptext" class="form-text text-muted">Insert your email</small>
</div>
</div>
<div id="div_id_first_name" class="form-group">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
class="asteriskField">*</span> </label>
<div> <input type="text" name="email" maxlength="30" aria-describedby="id_email_helptext" aria-invalid="true"
class="textinput textInput inputtext form-control is-invalid" required id="id_email"> <small
id="hint_id_email" class="form-text text-muted">Insert your email</small> </div>
id="id_email_helptext" class="form-text text-muted">Insert your email</small> </div>
</div>
<div id="div_id_password1" class="form-group"> <label for="id_password1" class=" requiredField"> password<span
class="asteriskField">*</span> </label>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
class="asteriskField">*</span> </label>
<div> <input type="text" name="email" maxlength="30"
class="textinput textInput inputtext form-control is-invalid" required id="id_email"> <small
id="hint_id_email" class="form-text text-muted">Insert your email</small> </div>
id="id_email_helptext" class="form-text text-muted">Insert your email</small> </div>
</div>
<div id="div_id_password1" class="form-group"> <label for="id_password1" class=" requiredField"> password<span
class="asteriskField">*</span> </label>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<div> <input type="text" name="email" maxlength="30" aria-describedby="id_email_helptext" aria-invalid="true"
class="textinput textInput inputtext form-control is-invalid" required id="id_email"> <span
id="error_1_id_email" class="invalid-feedback"><strong>This field is required.</strong></span> <small
id="hint_id_email" class="form-text text-muted">Insert your email</small> </div>
id="id_email_helptext" class="form-text text-muted">Insert your email</small> </div>
</div>
<div id="div_id_password1" class="form-group"> <label for="id_password1" class=" requiredField"> password<span
class="asteriskField">*</span> </label>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<div> <input type="text" name="email" maxlength="30"
class="textinput textInput inputtext form-control is-invalid" required id="id_email"> <span
id="error_1_id_email" class="invalid-feedback"><strong>This field is required.</strong></span> <small
id="hint_id_email" class="form-text text-muted">Insert your email</small> </div>
id="id_email_helptext" class="form-text text-muted">Insert your email</small> </div>
</div>
<div id="div_id_password1" class="form-group"> <label for="id_password1" class=" requiredField"> password<span
class="asteriskField">*</span> </label>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<div class="input-group-append active">
<span class="input-group-text">gmail.com</span>
</div>
</div> <small id="hint_id_email" class="form-text text-muted">Insert your email</small>
</div> <small id="id_email_helptext" class="form-text text-muted">Insert your email</small>
</div>
</div>
<div id="div_id_password1" class="form-group">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<div class="input-group-append active">
<span class="input-group-text">gmail.com</span>
</div>
</div> <small id="hint_id_email" class="form-text text-muted">Insert your email</small>
</div> <small id="id_email_helptext" class="form-text text-muted">Insert your email</small>
</div>
</div>
<div id="div_id_password1" class="form-group">
Expand Down
4 changes: 3 additions & 1 deletion tests/test_form_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -556,7 +556,9 @@ def test_error_and_help_inline():

# Check that error goes before help, otherwise CSS won't work
error_position = html.find('<span id="error_1_id_email" class="help-inline">')
help_position = html.find('<small id="hint_id_email" class="form-text text-muted">')
help_position = html.find(
'<small id="id_email_helptext" class="form-text text-muted">'
)
assert error_position < help_position


Expand Down
2 changes: 1 addition & 1 deletion tests/test_layout_objects.py
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ def test_accordion_and_accordiongroup(self):

accordion_id = match.group(1)

assert html.count('<div class="card mb-2"') == 2
assert html.count('<div class="card mb-2') == 2
assert html.count('<div class="card-header"') == 2

assert html.count('data-parent="#{}"'.format(accordion_id)) == 2
Expand Down