diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 053e36fa9..0f7a9e88e 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,18 +1,24 @@ +exclude: 'dsfr/static/dsfr/dist' repos: - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.0.283 + rev: v0.1.3 hooks: - id: ruff args: [ --fix, --exit-non-zero-on-fix ] +- repo: https://github.com/pre-commit/pre-commit-hooks + rev: v4.5.0 + hooks: + - id: end-of-file-fixer + - id: trailing-whitespace - repo: https://github.com/psf/black - rev: 22.10.0 + rev: 23.10.1 hooks: - id: black language_version: python3.10 args: - --line-length=88 - repo: https://github.com/PyCQA/bandit - rev: 1.7.4 + rev: 1.7.5 hooks: - id: bandit language_version: python3 diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index dbfcd0d51..c18f42fb7 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -5,7 +5,7 @@ L’installation a été testée sur Ubuntu 22.04 avec Python 3.10 et poetry ins - Faire un `git clone` du projet sur votre machine et ouvrir un terminal -- Installer l’environnement virtuel, les dépendances et initialiser le site d’exemple : +- Installer l’environnement virtuel, les dépendances, les *pre-commit hooks* et initialiser le site d’exemple : ``` make init ``` @@ -62,9 +62,17 @@ Pour vérifier son code, on peut intégrer le linter adapté à son IDE et aussi make checkstyle ``` +Une vérification automatique est faite via des *pre-commit hooks*, qui ont normalement été installés via le `make init`. + +Il est possible de les mettre à jour avec la commande : + +``` +pre-commit update +``` + ## Mise à jour du système de design -Quand une nouvelle version du système de design de l’État est publiée, il est possible de le mettre à jour automatiquement via la commande +Quand une nouvelle version du système de design de l’État est publiée, il est possible de le mettre à jour automatiquement via la commande ``` make update_dsfr ``` diff --git a/LICENSE b/LICENSE index b21b8e9b0..7b6007786 100644 --- a/LICENSE +++ b/LICENSE @@ -1,5 +1,6 @@ -Le contenu de ce dépôt est placé sous licence MIT License, à l'exception de la fonte Marianne. -Voir les [conditions générales d'utilisation](doc/legal/cgu.md) +Le contenu de ce dépôt est placé sous licence MIT, à l’exception de la fonte Marianne. + +Voir les [conditions générales d’utilisation](https://github.com/GouvernementFR/dsfr/blob/main/doc/legal/cgu.md) Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/Makefile b/Makefile index a6020c866..f92ee6871 100644 --- a/Makefile +++ b/Makefile @@ -13,10 +13,11 @@ endif # Commands checkstyle: - poetry run ruff check . + poetry run pre-commit run --all-files init: poetry install + poetry run pre-commit install poetry run python manage.py migrate poetry run python manage.py collectstatic --noinput poetry run python manage.py import_sample_data diff --git a/README.rst b/README.rst index 2b6fe6a3c..2fd2a490c 100644 --- a/README.rst +++ b/README.rst @@ -39,7 +39,7 @@ Quick start "dsfr", ] - + 3. In order to use forms and formsets, add to INSTALLED_APPS in your settings.py:: INSTALLED_APPS = [ @@ -52,7 +52,7 @@ Quick start 4. Add the following info in the TEMPLATES section in your settings.py so that the choice forms work:: TEMPLATES = [ - { + { [...] "DIRS": [ os.path.join(BASE_DIR, "dsfr/templates"), @@ -81,4 +81,4 @@ Quick start 7. Include the tags in your base.html file (see example file at https://github.com/entrepreneur-interet-general/django-dsfr/blob/main/example_app/templates/example_app/base.html) -8. Start the development server and visit http://127.0.0.1:8000/ \ No newline at end of file +8. Start the development server and visit http://127.0.0.1:8000/ diff --git a/dsfr/fixtures/init.json b/dsfr/fixtures/init.json index 833dfb076..1f3df8d44 100644 --- a/dsfr/fixtures/init.json +++ b/dsfr/fixtures/init.json @@ -12,4 +12,4 @@ "mourning": false, "accessibility_status": "NOT" } -}] \ No newline at end of file +}] diff --git a/dsfr/migrations/0001_initial.py b/dsfr/migrations/0001_initial.py index 71abc66d0..b1ccd32d1 100644 --- a/dsfr/migrations/0001_initial.py +++ b/dsfr/migrations/0001_initial.py @@ -4,7 +4,6 @@ class Migration(migrations.Migration): - initial = True dependencies = [] diff --git a/dsfr/migrations/0002_auto_20211209_1557.py b/dsfr/migrations/0002_auto_20211209_1557.py index fd20ed008..600cc1591 100644 --- a/dsfr/migrations/0002_auto_20211209_1557.py +++ b/dsfr/migrations/0002_auto_20211209_1557.py @@ -4,7 +4,6 @@ class Migration(migrations.Migration): - dependencies = [ ("dsfr", "0001_initial"), ] diff --git a/dsfr/migrations/0003_alter_dsfrconfig_accessibility_status.py b/dsfr/migrations/0003_alter_dsfrconfig_accessibility_status.py index 2d453f559..17a0f1d6e 100644 --- a/dsfr/migrations/0003_alter_dsfrconfig_accessibility_status.py +++ b/dsfr/migrations/0003_alter_dsfrconfig_accessibility_status.py @@ -4,7 +4,6 @@ class Migration(migrations.Migration): - dependencies = [ ("dsfr", "0002_auto_20211209_1557"), ] diff --git a/dsfr/static/formsets.js b/dsfr/static/formsets.js index 961d3c082..4b97a5cfb 100644 --- a/dsfr/static/formsets.js +++ b/dsfr/static/formsets.js @@ -12,7 +12,7 @@ try { div_remove.remove(); } } -catch (TypeError) {} +catch (error) {} let firstForm = formsetGroup[0].cloneNode(true); // Clone the formset @@ -20,7 +20,7 @@ addButton.addEventListener('click', addForm); function addForm(e) { // Add a form to the formset - + e.preventDefault(); let newForm @@ -29,30 +29,30 @@ function addForm(e) { } else { newForm = firstForm; // If all other forms have been deleted } - + // Regex - let formRegex = RegExp(`\\w+-(\\d+)-`,'g'); // Regex to find all instances of the form number - let idRemoveFormRegex = RegExp(`remove-(\\d+)`,'g'); // Regex to find all instances of the form number on remove link - let idRemoveFunctionRegex = RegExp(`removeFormset\\((\\d+)\\)`,'g'); // Regex to find all instances of the form number on remove function in link - + let formRegex = /\w+-(\d+)-/g; // Regex to find all instances of the form number + let idRemoveFormRegex = /remove-(\d+)/g; // Regex to find all instances of the form number on remove link + let idRemoveFunctionRegex = /removeFormset\((\d+)\)/g; // Regex to find all instances of the form number on remove function in link + // Get the number of the last form on the page formsetGroup = document.querySelectorAll(".formset"); + + let last_number = 0; if (formsetGroup.length > 0){ - last_form = formsetGroup[formsetGroup.length-1]; // Get the last form in the formset - last_number = last_form.innerHTML.match(/\w+-(\d+)-\w+/)[1]; // Get the form number in the last form with a regex (fields in the form have an id following the pattern "form-X-...." where X is the number of the form) - } else { - last_number = 0; + let last_form = formsetGroup[formsetGroup.length-1]; // Get the last form in the formset + last_number = /\w+-(\d+)-\w+/.exec(last_form.innerHTML)[1]; // Get the form number in the last form with a regex (fields in the form have an id following the pattern "form-X-...." where X is the number of the form) } - - - newNumber = parseInt(last_number)+1; // Number of the new form + + + let newNumber = parseInt(last_number)+1; // Number of the new form // Replace last number by new number in newForm newForm.innerHTML = newForm.innerHTML.replace(formRegex, `form-${newNumber}-`); // Update the new form to have the correct form number newForm.setAttribute('id', `formset-${newNumber}`); // Update the new form to have the correct form id newForm.innerHTML = newForm.innerHTML.replace(idRemoveFormRegex, `remove-${newNumber}`); // Update the new form to have the correct form number on remove link - newForm.innerHTML = newForm.innerHTML.replace(idRemoveFunctionRegex, `removeFormset\(${newNumber}\)`); // Update the new form to have the correct form number on remove function in link - + newForm.innerHTML = newForm.innerHTML.replace(idRemoveFunctionRegex, `removeFormset(${newNumber})`); // Update the new form to have the correct form number on remove function in link + // Insert the new form at the end of the list of forms container.insertBefore(newForm, addButton); @@ -62,14 +62,14 @@ function addForm(e) { function removeFormset(numFormset){ // Remove a form from the formset thanks to the form id - + // Get the form by its id - var form_id = "formset-" + numFormset; - var form = document.getElementById(form_id); - + let form_id = "formset-" + numFormset; + let form = document.getElementById(form_id); + // Remove the form from the formset form.remove(); - + // Update total number of forms in the management form formsetGroup = document.querySelectorAll(".formset"); totalForms.setAttribute('value', `${formsetGroup.length}`); diff --git a/dsfr/templates/django/forms/widgets/checkbox_option.html b/dsfr/templates/django/forms/widgets/checkbox_option.html index 1984a6a40..644227d43 100644 --- a/dsfr/templates/django/forms/widgets/checkbox_option.html +++ b/dsfr/templates/django/forms/widgets/checkbox_option.html @@ -10,4 +10,4 @@ {% endif %} {% endif %} -{% if widget.attrs.dsfr == "dsfr" %}{% endif %} \ No newline at end of file +{% if widget.attrs.dsfr == "dsfr" %}{% endif %} diff --git a/dsfr/templates/django/forms/widgets/multiple_input.html b/dsfr/templates/django/forms/widgets/multiple_input.html index 51442e9e7..39080676f 100644 --- a/dsfr/templates/django/forms/widgets/multiple_input.html +++ b/dsfr/templates/django/forms/widgets/multiple_input.html @@ -4,4 +4,4 @@ {% include option.template_name with widget=option %} {% endfor %} {% endfor %} -{% endwith %} \ No newline at end of file +{% endwith %} diff --git a/dsfr/templates/django/forms/widgets/radio_option.html b/dsfr/templates/django/forms/widgets/radio_option.html index b0decfdba..5fa99696f 100644 --- a/dsfr/templates/django/forms/widgets/radio_option.html +++ b/dsfr/templates/django/forms/widgets/radio_option.html @@ -10,4 +10,4 @@ {% endif %} {% endif %} -{% if widget.attrs.dsfr == "dsfr" %}{% endif %} \ No newline at end of file +{% if widget.attrs.dsfr == "dsfr" %}{% endif %} diff --git a/dsfr/templates/dsfr/accordion.html b/dsfr/templates/dsfr/accordion.html index 57017fa20..120fb4a23 100644 --- a/dsfr/templates/dsfr/accordion.html +++ b/dsfr/templates/dsfr/accordion.html @@ -5,4 +5,4 @@
{{ self.content | safe }}
- \ No newline at end of file + diff --git a/dsfr/templates/dsfr/alert.html b/dsfr/templates/dsfr/alert.html index ca109bf8e..96c24370f 100644 --- a/dsfr/templates/dsfr/alert.html +++ b/dsfr/templates/dsfr/alert.html @@ -8,4 +8,4 @@ {% endif %} -{% if self.is_collapsible %}{% endif %} \ No newline at end of file +{% if self.is_collapsible %}{% endif %} diff --git a/dsfr/templates/dsfr/badge.html b/dsfr/templates/dsfr/badge.html index 334ce672c..651fcc6c7 100644 --- a/dsfr/templates/dsfr/badge.html +++ b/dsfr/templates/dsfr/badge.html @@ -1 +1 @@ -

{{ self.label }}

\ No newline at end of file +

{{ self.label }}

diff --git a/dsfr/templates/dsfr/badge_group.html b/dsfr/templates/dsfr/badge_group.html index 099a38fba..70f7ce181 100644 --- a/dsfr/templates/dsfr/badge_group.html +++ b/dsfr/templates/dsfr/badge_group.html @@ -5,4 +5,4 @@ {% dsfr_badge item %} {% endfor %} - \ No newline at end of file + diff --git a/dsfr/templates/dsfr/base.html b/dsfr/templates/dsfr/base.html index c3c21bb2f..94713b718 100644 --- a/dsfr/templates/dsfr/base.html +++ b/dsfr/templates/dsfr/base.html @@ -43,4 +43,4 @@ {% dsfr_js nonce=request.csp_nonce %} {% block extra_js %}{% endblock extra_js %} - \ No newline at end of file + diff --git a/dsfr/templates/dsfr/breadcrumb.html b/dsfr/templates/dsfr/breadcrumb.html index 55b8d585d..7bcb67b1b 100644 --- a/dsfr/templates/dsfr/breadcrumb.html +++ b/dsfr/templates/dsfr/breadcrumb.html @@ -15,4 +15,4 @@ - \ No newline at end of file + diff --git a/dsfr/templates/dsfr/button.html b/dsfr/templates/dsfr/button.html index 1971224a5..d3d2335da 100644 --- a/dsfr/templates/dsfr/button.html +++ b/dsfr/templates/dsfr/button.html @@ -6,4 +6,4 @@ {% if self.name %}name="{{ self.name }}"{% endif %} > {{ self.label }} - \ No newline at end of file + diff --git a/dsfr/templates/dsfr/callout.html b/dsfr/templates/dsfr/callout.html index 2a71afc77..4c4e59ae7 100644 --- a/dsfr/templates/dsfr/callout.html +++ b/dsfr/templates/dsfr/callout.html @@ -15,4 +15,4 @@ {{ self.button.label }} {% endif %} {% endif %} - \ No newline at end of file + diff --git a/dsfr/templates/dsfr/favicon.html b/dsfr/templates/dsfr/favicon.html index 9b3fa50a3..6237cc95f 100644 --- a/dsfr/templates/dsfr/favicon.html +++ b/dsfr/templates/dsfr/favicon.html @@ -2,4 +2,4 @@ - \ No newline at end of file + diff --git a/dsfr/templates/dsfr/footer.html b/dsfr/templates/dsfr/footer.html index f0a8fe8f5..e489e6b99 100644 --- a/dsfr/templates/dsfr/footer.html +++ b/dsfr/templates/dsfr/footer.html @@ -58,4 +58,4 @@ - \ No newline at end of file + diff --git a/dsfr/templates/dsfr/form_base.html b/dsfr/templates/dsfr/form_base.html index a8d44d858..7fba3f5bb 100644 --- a/dsfr/templates/dsfr/form_base.html +++ b/dsfr/templates/dsfr/form_base.html @@ -9,7 +9,7 @@ {% comment %} Radio button and multiple checkboxes : - -Help text under each button/checkbox : + -Help text under each button/checkbox : In your forms.py, in the ChoiceField or MultipleChoiceField, instead of choices=(("a", "label a"), ("b", "label b"), ...), put choices=(("a", {"label":"label a", "help_text":"help text a"}), ("b", {"label":"label b", "help_text":"help text b"})), @@ -32,7 +32,7 @@
{% csrf_token %} - + {# Everything that needs to be in the form but before the fields (form title for example) #} {% block head_form %} {% endblock head_form %} @@ -46,23 +46,23 @@ {# Everything that needs to be in the for loop #} {% block inside_form %} {% endblock inside_form %} - + {% include "dsfr/form_field_snippets/field_snippet.html" %} {% endfor %} - + {# If you need to add formsets after the form #} {% block extra_formset_after %} {% endblock extra_formset_after %} {# Everything that needs to be in the form but after the fields (the buttons for example) #} -
+
{% block foot_form %} {% endblock foot_form %}
- + {# Everything that needs to be outside the form, after #} {% block after_form %} {% endblock after_form %} -{% endblock content %} +{% endblock content %} diff --git a/dsfr/templates/dsfr/form_field_snippets/checkbox_snippet.html b/dsfr/templates/dsfr/form_field_snippets/checkbox_snippet.html index bbc54be09..da5a915ca 100644 --- a/dsfr/templates/dsfr/form_field_snippets/checkbox_snippet.html +++ b/dsfr/templates/dsfr/form_field_snippets/checkbox_snippet.html @@ -7,14 +7,14 @@ {% else %} {{ field|attr:"type:checkbox" }} {% endif %} - + - + {% if field.errors %}
{{ field.errors }} diff --git a/dsfr/templates/dsfr/form_snippet.html b/dsfr/templates/dsfr/form_snippet.html index 9a4193262..ff846ee1b 100644 --- a/dsfr/templates/dsfr/form_snippet.html +++ b/dsfr/templates/dsfr/form_snippet.html @@ -1,3 +1,3 @@ {% for field in form %} {% include "dsfr/form_field_snippets/field_snippet.html" %} -{% endfor %} \ No newline at end of file +{% endfor %} diff --git a/dsfr/templates/dsfr/formset_base.html b/dsfr/templates/dsfr/formset_base.html index 6e17d4477..e838a9e04 100644 --- a/dsfr/templates/dsfr/formset_base.html +++ b/dsfr/templates/dsfr/formset_base.html @@ -40,7 +40,7 @@
{% endif %} {% endblock form_set %} - + {% block extra_js %} {% endblock %} diff --git a/dsfr/templates/dsfr/global_css.html b/dsfr/templates/dsfr/global_css.html index ec0ee1f11..f5258116c 100644 --- a/dsfr/templates/dsfr/global_css.html +++ b/dsfr/templates/dsfr/global_css.html @@ -2,4 +2,4 @@ - \ No newline at end of file + diff --git a/dsfr/templates/dsfr/global_js.html b/dsfr/templates/dsfr/global_js.html index 07b904ceb..daf0d2478 100644 --- a/dsfr/templates/dsfr/global_js.html +++ b/dsfr/templates/dsfr/global_js.html @@ -1,3 +1,3 @@ {% load static %} - \ No newline at end of file + diff --git a/dsfr/templates/dsfr/header.html b/dsfr/templates/dsfr/header.html index 7fb0706f6..006a9ac83 100644 --- a/dsfr/templates/dsfr/header.html +++ b/dsfr/templates/dsfr/header.html @@ -78,4 +78,4 @@
{% endblock main_menu %} - \ No newline at end of file + diff --git a/dsfr/templates/dsfr/highlight.html b/dsfr/templates/dsfr/highlight.html index 3e7f4bcf9..c3f686745 100644 --- a/dsfr/templates/dsfr/highlight.html +++ b/dsfr/templates/dsfr/highlight.html @@ -2,4 +2,4 @@

{{ self.content | safe }}

- \ No newline at end of file + diff --git a/dsfr/templates/dsfr/input.html b/dsfr/templates/dsfr/input.html index c2eabb0f0..0c99db533 100644 --- a/dsfr/templates/dsfr/input.html +++ b/dsfr/templates/dsfr/input.html @@ -12,4 +12,4 @@ {% if self.min %}min="{{ self.min }}"{% endif %} {% if self.max %}max="{{ self.max }}"{% endif %} /> - \ No newline at end of file + diff --git a/dsfr/templates/dsfr/link.html b/dsfr/templates/dsfr/link.html index e2d63477e..985456aab 100644 --- a/dsfr/templates/dsfr/link.html +++ b/dsfr/templates/dsfr/link.html @@ -1,7 +1,7 @@ - {{ self.label }}{% if self.is_external %} Ouvre une nouvelle fenêtre{% endif %} - \ No newline at end of file + diff --git a/dsfr/templates/dsfr/pagination.html b/dsfr/templates/dsfr/pagination.html index 38ddd4a3d..e6accbf30 100644 --- a/dsfr/templates/dsfr/pagination.html +++ b/dsfr/templates/dsfr/pagination.html @@ -32,7 +32,7 @@ {% else %}
  • - - @@ -76,4 +76,4 @@
  • - \ No newline at end of file + diff --git a/dsfr/templates/dsfr/quote.html b/dsfr/templates/dsfr/quote.html index e60438f3a..3abfae03f 100644 --- a/dsfr/templates/dsfr/quote.html +++ b/dsfr/templates/dsfr/quote.html @@ -20,4 +20,4 @@ {% endif %} - \ No newline at end of file + diff --git a/dsfr/templates/dsfr/select.html b/dsfr/templates/dsfr/select.html index 32a117817..ef8bcf123 100644 --- a/dsfr/templates/dsfr/select.html +++ b/dsfr/templates/dsfr/select.html @@ -23,4 +23,4 @@ {% endfor %} - \ No newline at end of file + diff --git a/dsfr/templates/dsfr/sidemenu.html b/dsfr/templates/dsfr/sidemenu.html index c91f7784f..6db507f9e 100644 --- a/dsfr/templates/dsfr/sidemenu.html +++ b/dsfr/templates/dsfr/sidemenu.html @@ -59,4 +59,4 @@ - \ No newline at end of file + diff --git a/dsfr/templates/dsfr/skiplinks.html b/dsfr/templates/dsfr/skiplinks.html index c02f0d839..3f2f06b0d 100644 --- a/dsfr/templates/dsfr/skiplinks.html +++ b/dsfr/templates/dsfr/skiplinks.html @@ -8,4 +8,4 @@ {% endfor %} - \ No newline at end of file + diff --git a/dsfr/templates/dsfr/stepper.html b/dsfr/templates/dsfr/stepper.html index dd836f28f..4f53d5864 100644 --- a/dsfr/templates/dsfr/stepper.html +++ b/dsfr/templates/dsfr/stepper.html @@ -9,4 +9,4 @@

    Étape suivante : {{ self.next_step_title }}

    {% endif %} - \ No newline at end of file + diff --git a/dsfr/templates/dsfr/summary.html b/dsfr/templates/dsfr/summary.html index 704ea273e..86dee78f6 100644 --- a/dsfr/templates/dsfr/summary.html +++ b/dsfr/templates/dsfr/summary.html @@ -7,4 +7,4 @@ {% endfor %} - \ No newline at end of file + diff --git a/dsfr/templates/dsfr/table.html b/dsfr/templates/dsfr/table.html index 384780ba7..60f7ede67 100644 --- a/dsfr/templates/dsfr/table.html +++ b/dsfr/templates/dsfr/table.html @@ -20,4 +20,4 @@ {% endfor %} - \ No newline at end of file + diff --git a/dsfr/templates/dsfr/tag.html b/dsfr/templates/dsfr/tag.html index e0a41112c..cd2c97dfe 100644 --- a/dsfr/templates/dsfr/tag.html +++ b/dsfr/templates/dsfr/tag.html @@ -1 +1 @@ -<{% if self.link %}a href="{{ self.link }}"{% elif self.is_selectable or self.is_dismissable %}button{% else %}p{% endif %} class="fr-tag{% if self.is_dismissable %} fr-tag--dismiss{% endif %}{% if self.extra_classes %} {{ self.extra_classes }}{% endif %}"{% if self.is_selectable %} aria-pressed="false"{% endif %}{% if self.is_dismissable %} aria-label="Retirer le filtre {{ self.label }}"{% endif %}{% if self.onclick %} onclick="{{ self.onclick }}"{% elif self.is_dismissable %} onclick="event.preventDefault(); this.parentNode.removeChild(this);"{% endif %}>{{ self.label }} \ No newline at end of file +<{% if self.link %}a href="{{ self.link }}"{% elif self.is_selectable or self.is_dismissable %}button{% else %}p{% endif %} class="fr-tag{% if self.is_dismissable %} fr-tag--dismiss{% endif %}{% if self.extra_classes %} {{ self.extra_classes }}{% endif %}"{% if self.is_selectable %} aria-pressed="false"{% endif %}{% if self.is_dismissable %} aria-label="Retirer le filtre {{ self.label }}"{% endif %}{% if self.onclick %} onclick="{{ self.onclick }}"{% elif self.is_dismissable %} onclick="event.preventDefault(); this.parentNode.removeChild(this);"{% endif %}>{{ self.label }} diff --git a/dsfr/templates/dsfr/theme_modale.html b/dsfr/templates/dsfr/theme_modale.html index bf7ec38f5..b291694b2 100644 --- a/dsfr/templates/dsfr/theme_modale.html +++ b/dsfr/templates/dsfr/theme_modale.html @@ -55,4 +55,4 @@

    - \ No newline at end of file + diff --git a/dsfr/test/test_templatetags.py b/dsfr/test/test_templatetags.py index 9de76057b..5a74a02ac 100644 --- a/dsfr/test/test_templatetags.py +++ b/dsfr/test/test_templatetags.py @@ -381,7 +381,7 @@ def test_highlight_tag_rendered(self): rendered_template = self.template_to_render.render(self.context) self.assertInHTML( """ -
    +

    Content of the highlight item (can include html)

    @@ -426,7 +426,7 @@ def test_text_input_tag_rendered(self): id="sample-id" name="sample-id" onchange="doStuff()" - value="Sample value" + value="Sample value" />
    """, @@ -474,7 +474,7 @@ def test_link_tag_rendered(self): rendered_template = self.template_to_render.render(self.context) self.assertInHTML( """ - - +
  • Page active @@ -647,14 +647,14 @@ def test_summary_tag_rendered(self): """, # noqa diff --git a/example_app/admin.py b/example_app/admin.py index a97db1152..0251239f0 100644 --- a/example_app/admin.py +++ b/example_app/admin.py @@ -2,6 +2,7 @@ from example_app.models import Author, Genre, Book + # Register your models here. @admin.register(Author) class AuthorAdmin(admin.ModelAdmin): diff --git a/example_app/migrations/0001_initial.py b/example_app/migrations/0001_initial.py index 1092536f7..3aa279704 100644 --- a/example_app/migrations/0001_initial.py +++ b/example_app/migrations/0001_initial.py @@ -5,7 +5,6 @@ class Migration(migrations.Migration): - initial = True dependencies = [] diff --git a/example_app/models.py b/example_app/models.py index 1cd54d53b..65364e7ac 100644 --- a/example_app/models.py +++ b/example_app/models.py @@ -2,6 +2,7 @@ # Create your models here. + # These are example models to show how form and formset can work class Author(models.Model): first_name = models.CharField("Prénom", max_length=250, null=False, blank=False) diff --git a/example_app/templates/example_app/blocks/header.html b/example_app/templates/example_app/blocks/header.html index 0d2fad123..1a6b1c9c0 100644 --- a/example_app/templates/example_app/blocks/header.html +++ b/example_app/templates/example_app/blocks/header.html @@ -41,4 +41,4 @@
  • -{% endblock main_menu %} \ No newline at end of file +{% endblock main_menu %} diff --git a/example_app/templates/example_app/index.html b/example_app/templates/example_app/index.html index 820f6c054..cfabf4c23 100644 --- a/example_app/templates/example_app/index.html +++ b/example_app/templates/example_app/index.html @@ -18,7 +18,7 @@

    Documentation

    Django-dsfr est une application django permettant d’utiliser le système de design de l’État dans des projets Django.

    - +

    Elle a été développée dans le cadre du défi Open Collectivités @@ -55,4 +55,4 @@

    Notes

  • De même pour certains où il vaut mieux créer un template ad-hoc à chaque utilisation, comme les modales.
  • La présente documentation est un export statique de l’application example_app réalisé avec Django-distill.
  • -{% endblock %} \ No newline at end of file +{% endblock %} diff --git a/example_app/templates/example_app/not_yet.html b/example_app/templates/example_app/not_yet.html index c761ff936..b32cc64df 100644 --- a/example_app/templates/example_app/not_yet.html +++ b/example_app/templates/example_app/not_yet.html @@ -7,4 +7,4 @@

    {{title}}

    {% dsfr_callout not_yet %}
    -{% endblock content %} \ No newline at end of file +{% endblock content %} diff --git a/example_app/templates/example_app/page_form.html b/example_app/templates/example_app/page_form.html index b819a63b6..0f61e6d9e 100644 --- a/example_app/templates/example_app/page_form.html +++ b/example_app/templates/example_app/page_form.html @@ -11,4 +11,4 @@

    Exemple de formulaire

    -{% endblock content %} \ No newline at end of file +{% endblock content %} diff --git a/example_app/templates/example_app/page_tag.html b/example_app/templates/example_app/page_tag.html index 1e0cc9717..9a5d486eb 100644 --- a/example_app/templates/example_app/page_tag.html +++ b/example_app/templates/example_app/page_tag.html @@ -4,7 +4,7 @@ {% block extra_css %}