Skip to content

Commit

Permalink
[Formulaires] Autoriser le HTML dans le texte d’aide des champs de fo…
Browse files Browse the repository at this point in the history
…rmulaire (#183)

* Allow HTML in help text in form fields

* Update version number
  • Loading branch information
Ash-Crow authored Nov 13, 2024
1 parent bee2749 commit 6d764bd
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
6 changes: 4 additions & 2 deletions dsfr/templates/dsfr/form_field_snippets/input_snippet.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@
{# Generic input snippet used by most of the field types #}
<div class="{{ field.field.widget.group_class|default:'fr-input-group' }}{% if field.errors %} {{ field.field.widget.group_class|default:'fr-input-group' }}--error{% endif %}{% if field.field.disabled %} fr-input-group--disabled{% endif %}">
<label for="{{ field.id_for_label }}" class="fr-label">
{# djlint:off #}
{{ field.label }}{% if field.field.required %}*{% endif %}
{% if field.help_text %}
<span class="fr-hint-text">{{ field.help_text }}</span>
<span class="fr-hint-text">{{ field.help_text|safe }}</span>
{% endif %}
{# djlint:on #}
</label>
{% if field.errors %}
{% with aria_describedby="aria-describedby:"|add:field.auto_id|add:"-desc-error" %}
Expand All @@ -19,4 +21,4 @@
{{ field.errors }}
</div>
{% endif %}
</div>
</div>
2 changes: 1 addition & 1 deletion example_app/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ class ExampleForm(DsfrBaseForm):

user_email = forms.EmailField(
label="Adresse électronique",
help_text="Format attendu : [email protected]",
help_text="Format attendu : <code>[email protected]</code>",
required=False,
)

Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ authors = ["Sylvain Boissel <[email protected]>"]
description = "Integrate the French government Design System into a Django app"
license = "MIT"
name = "django-dsfr"
version = "1.4.1"
version = "1.4.2"
classifiers = [
"Development Status :: 5 - Production/Stable",
"Environment :: Web Environment",
Expand Down

0 comments on commit 6d764bd

Please sign in to comment.