From 1a4422757b445bdcc4ff46d9d2eafa8a40ce36a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Reuiller?= Date: Thu, 6 Apr 2023 11:34:56 +0200 Subject: [PATCH 01/13] add cta under rich text --- .../migrations/0004_alter_contentpage_body.py | 595 ++++++++++++++++++ content_manager/models.py | 11 + .../content_manager/blocks/multicolumns.html | 10 + 3 files changed, 616 insertions(+) create mode 100644 content_manager/migrations/0004_alter_contentpage_body.py diff --git a/content_manager/migrations/0004_alter_contentpage_body.py b/content_manager/migrations/0004_alter_contentpage_body.py new file mode 100644 index 00000000..03487c9f --- /dev/null +++ b/content_manager/migrations/0004_alter_contentpage_body.py @@ -0,0 +1,595 @@ +# Generated by Django 4.1.5 on 2023-04-06 09:33 + +from django.db import migrations +import wagtail.blocks +import wagtail.documents.blocks +import wagtail.fields +import wagtail.images.blocks + + +class Migration(migrations.Migration): + + dependencies = [ + ("content_manager", "0003_alter_contentpage_body"), + ] + + operations = [ + migrations.AlterField( + model_name="contentpage", + name="body", + field=wagtail.fields.StreamField( + [ + ( + "hero", + wagtail.blocks.StructBlock( + [ + ( + "bg_image", + wagtail.images.blocks.ImageChooserBlock( + label="Image d'arrière plan" + ), + ), + ( + "bg_color", + wagtail.blocks.RegexBlock( + error_messages={ + "invalid": "La couleur n'est pas correcte, le format doit être #fff ou #f5f5fe" + }, + label="Couleur d'arrière plan au format hexa (Ex: #f5f5fe)", + regex="^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$", + required=False, + ), + ), + ("title", wagtail.blocks.CharBlock(label="Titre")), + ( + "text", + wagtail.blocks.CharBlock( + label="Texte", required=False + ), + ), + ( + "cta_label", + wagtail.blocks.CharBlock( + label="Texte du bouton", required=False + ), + ), + ( + "cta_link", + wagtail.blocks.URLBlock( + label="Lien du bouton", required=False + ), + ), + ], + label="Section promotionnelle", + ), + ), + ( + "title", + wagtail.blocks.StructBlock( + [ + ("title", wagtail.blocks.CharBlock(label="Titre")), + ( + "large", + wagtail.blocks.BooleanBlock( + label="Large", required=False + ), + ), + ], + label="Titre de page", + ), + ), + ( + "paragraph", + wagtail.blocks.RichTextBlock(label="Texte avec mise en forme"), + ), + ( + "paragraphlarge", + wagtail.blocks.RichTextBlock( + label="Texte avec mise en forme (large)" + ), + ), + ( + "image", + wagtail.blocks.StructBlock( + [ + ( + "title", + wagtail.blocks.CharBlock( + label="Titre", required=False + ), + ), + ( + "image", + wagtail.images.blocks.ImageChooserBlock( + label="Illustration" + ), + ), + ( + "alt", + wagtail.blocks.CharBlock( + label="Texte alternatif (description textuelle de l'image)", + required=False, + ), + ), + ( + "caption", + wagtail.blocks.CharBlock( + label="Légende", required=False + ), + ), + ( + "url", + wagtail.blocks.URLBlock( + label="Lien", required=False + ), + ), + ] + ), + ), + ( + "imageandtext", + wagtail.blocks.StructBlock( + [ + ( + "image", + wagtail.images.blocks.ImageChooserBlock( + label="Illustration (à gauche)" + ), + ), + ( + "image_ratio", + wagtail.blocks.ChoiceBlock( + choices=[ + ("3", "3/12"), + ("5", "5/12"), + ("6", "6/12"), + ], + label="Largeur de l'image", + ), + ), + ( + "text", + wagtail.blocks.RichTextBlock( + label="Texte avec mise en forme (à droite)" + ), + ), + ( + "link_label", + wagtail.blocks.CharBlock( + help_text="Le lien apparait en bas du bloc de droite, avec une flèche", + label="Titre du lien", + required=False, + ), + ), + ( + "link_url", + wagtail.blocks.URLBlock( + label="Lien", required=False + ), + ), + ], + label="Bloc image à gauche et texte à droite", + ), + ), + ( + "alert", + wagtail.blocks.StructBlock( + [ + ( + "title", + wagtail.blocks.CharBlock( + label="Titre du message", required=False + ), + ), + ( + "description", + wagtail.blocks.TextBlock( + label="Texte du message", required=False + ), + ), + ( + "level", + wagtail.blocks.ChoiceBlock( + choices=[ + ("error", "Erreur"), + ("success", "Succès"), + ("info", "Information"), + ("warning", "Attention"), + ], + label="Type de message", + ), + ), + ], + label="Message d'alerte", + ), + ), + ( + "callout", + wagtail.blocks.StructBlock( + [ + ( + "title", + wagtail.blocks.CharBlock( + label="Titre de la mise en vant", required=False + ), + ), + ( + "text", + wagtail.blocks.TextBlock( + label="Texte mis en avant", required=False + ), + ), + ], + label="Texte mise en avant", + ), + ), + ( + "quote", + wagtail.blocks.StructBlock( + [ + ( + "image", + wagtail.images.blocks.ImageChooserBlock( + label="Illustration (à gauche)", required=False + ), + ), + ("quote", wagtail.blocks.CharBlock(label="Citation")), + ( + "author_name", + wagtail.blocks.CharBlock(label="Nom de l'auteur"), + ), + ( + "author_title", + wagtail.blocks.CharBlock(label="Titre de l'auteur"), + ), + ], + label="Citation", + ), + ), + ( + "video", + wagtail.blocks.StructBlock( + [ + ( + "title", + wagtail.blocks.CharBlock( + label="Titre", required=False + ), + ), + ("caption", wagtail.blocks.CharBlock(label="Légende")), + ( + "url", + wagtail.blocks.URLBlock( + help_text="URL au format 'embed' (Ex. : https://www.youtube.com/embed/gLzXOViPX-0)", + label="Lien de la vidéo", + ), + ), + ], + label="Vidéo", + ), + ), + ( + "multicolumns", + wagtail.blocks.StructBlock( + [ + ( + "bg_image", + wagtail.images.blocks.ImageChooserBlock( + label="Image d'arrière plan", required=False + ), + ), + ( + "bg_color", + wagtail.blocks.RegexBlock( + error_messages={ + "invalid": "La couleur n'est pas correcte, le format doit être #fff ou #f5f5fe" + }, + label="Couleur d'arrière plan au format hexa (Ex: #f5f5fe)", + regex="^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$", + required=False, + ), + ), + ( + "title", + wagtail.blocks.CharBlock( + label="Titre", required=False + ), + ), + ( + "columns", + wagtail.blocks.StreamBlock( + [ + ( + "text", + wagtail.blocks.RichTextBlock( + label="Texte avec mise en forme" + ), + ), + ( + "image", + wagtail.blocks.StructBlock( + [ + ( + "title", + wagtail.blocks.CharBlock( + label="Titre", + required=False, + ), + ), + ( + "image", + wagtail.images.blocks.ImageChooserBlock( + label="Illustration" + ), + ), + ( + "alt", + wagtail.blocks.CharBlock( + label="Texte alternatif (description textuelle de l'image)", + required=False, + ), + ), + ( + "caption", + wagtail.blocks.CharBlock( + label="Légende", + required=False, + ), + ), + ( + "url", + wagtail.blocks.URLBlock( + label="Lien", + required=False, + ), + ), + ], + label="Image", + ), + ), + ( + "video", + wagtail.blocks.StructBlock( + [ + ( + "title", + wagtail.blocks.CharBlock( + label="Titre", + required=False, + ), + ), + ( + "caption", + wagtail.blocks.CharBlock( + label="Légende" + ), + ), + ( + "url", + wagtail.blocks.URLBlock( + help_text="URL au format 'embed' (Ex. : https://www.youtube.com/embed/gLzXOViPX-0)", + label="Lien de la vidéo", + ), + ), + ], + label="Vidéo", + ), + ), + ( + "card", + wagtail.blocks.StructBlock( + [ + ( + "title", + wagtail.blocks.CharBlock( + label="Titre" + ), + ), + ( + "description", + wagtail.blocks.TextBlock( + label="Texte" + ), + ), + ( + "image", + wagtail.images.blocks.ImageChooserBlock( + label="Image" + ), + ), + ( + "url", + wagtail.blocks.URLBlock( + label="Lien", + required=False, + ), + ), + ( + "document", + wagtail.documents.blocks.DocumentChooserBlock( + help_text="Sélectionnez un document pour rendre la carte cliquable vers celui ci (si le champ `Lien` n'est pas renseigné).", + label="ou Document", + required=False, + ), + ), + ], + label="Carte", + ), + ), + ( + "quote", + wagtail.blocks.StructBlock( + [ + ( + "image", + wagtail.images.blocks.ImageChooserBlock( + label="Illustration (à gauche)", + required=False, + ), + ), + ( + "quote", + wagtail.blocks.CharBlock( + label="Citation" + ), + ), + ( + "author_name", + wagtail.blocks.CharBlock( + label="Nom de l'auteur" + ), + ), + ( + "author_title", + wagtail.blocks.CharBlock( + label="Titre de l'auteur" + ), + ), + ], + label="Citation", + ), + ), + ( + "text_cta", + wagtail.blocks.StructBlock( + [ + ( + "text", + wagtail.blocks.RichTextBlock( + label="Texte avec mise en forme", + required=False, + ), + ), + ( + "cta_label", + wagtail.blocks.CharBlock( + help_text="Le lien apparait comme un bouton sous le bloc de texte", + label="Titre de l'appel à l'action", + required=False, + ), + ), + ( + "cta_url", + wagtail.blocks.CharBlock( + label="Lien", + required=False, + ), + ), + ], + label="Texte et appel à l'action", + ), + ), + ], + label="Multi-colonnes", + ), + ), + ], + label="Multi-colonnes", + ), + ), + ( + "accordions", + wagtail.blocks.StreamBlock( + [ + ("title", wagtail.blocks.CharBlock(label="Titre")), + ( + "accordion", + wagtail.blocks.StructBlock( + [ + ( + "title", + wagtail.blocks.CharBlock(label="Titre"), + ), + ( + "content", + wagtail.blocks.RichTextBlock( + label="Contenu" + ), + ), + ], + label="Accordéon", + max_num=15, + min_num=1, + ), + ), + ], + label="Accordéons", + ), + ), + ( + "stepper", + wagtail.blocks.StructBlock( + [ + ("title", wagtail.blocks.CharBlock(label="Titre")), + ( + "total", + wagtail.blocks.IntegerBlock(label="Nombre d'étape"), + ), + ( + "current", + wagtail.blocks.IntegerBlock(label="Étape en cours"), + ), + ( + "steps", + wagtail.blocks.StreamBlock( + [ + ( + "step", + wagtail.blocks.StructBlock( + [ + ( + "title", + wagtail.blocks.CharBlock( + label="Titre de l'étape" + ), + ), + ( + "detail", + wagtail.blocks.TextBlock( + label="Détail" + ), + ), + ], + label="Étape", + ), + ) + ], + label="Les étapes", + ), + ), + ], + label="Étapes", + ), + ), + ( + "separator", + wagtail.blocks.StructBlock( + [ + ( + "top_margin", + wagtail.blocks.IntegerBlock( + default=3, + label="Espacement au dessus", + max_value=15, + min_value=0, + ), + ), + ( + "bottom_margin", + wagtail.blocks.IntegerBlock( + default=3, + label="Espacement en dessous", + max_value=15, + min_value=0, + ), + ), + ], + label="Séparateur", + ), + ), + ], + blank=True, + use_json_field=True, + ), + ), + ] diff --git a/content_manager/models.py b/content_manager/models.py index a9348dde..59f50a91 100644 --- a/content_manager/models.py +++ b/content_manager/models.py @@ -139,12 +139,23 @@ class BadgesListBlock(blocks.StreamBlock): badge = BadgeBlock(label="Badge") +class TextAndCTA(blocks.StructBlock): + text = blocks.RichTextBlock(label="Texte avec mise en forme", required=False) + cta_label = blocks.CharBlock( + label="Titre de l'appel à l'action", + help_text="Le lien apparait comme un bouton sous le bloc de texte", + required=False, + ) + cta_url = blocks.CharBlock(label="Lien", required=False) + + class MultiColumnsBlock(blocks.StreamBlock): text = blocks.RichTextBlock(label="Texte avec mise en forme") image = ImageBlock(label="Image") video = VideoBlock(label="Vidéo") card = CardBlock(label="Carte") quote = QuoteBlock(label="Citation") + text_cta = TextAndCTA(label="Texte et appel à l'action") class MultiColumnsWithTitleBlock(blocks.StructBlock): diff --git a/content_manager/templates/content_manager/blocks/multicolumns.html b/content_manager/templates/content_manager/blocks/multicolumns.html index 4d7d8e4c..8ad8e75b 100644 --- a/content_manager/templates/content_manager/blocks/multicolumns.html +++ b/content_manager/templates/content_manager/blocks/multicolumns.html @@ -14,6 +14,16 @@

{{ block.value.title }}

{% for subblock in block.value.columns %} {% if subblock.block_type == 'text' %}
{{ subblock.value|richtext }}
+ {% elif subblock.block_type == 'text_cta' %} +
+ {{ subblock.value.text|richtext }} + {% if subblock.value.cta_url and subblock.value.cta_label %} +

+ {# It doesn't use dsfr_link or dsfr_button because it's a link with a button style #} + {{ subblock.value.cta_label }} +

+ {% endif %} +
{% elif subblock.block_type == 'image' %}
{% include "content_manager/blocks/image.html" with block=subblock %}
{% elif subblock.block_type == 'video' %} From 33e323adc98eb9f8dae9890518c78b1aab64269b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Reuiller?= Date: Thu, 6 Apr 2023 11:43:51 +0200 Subject: [PATCH 02/13] set black line length config --- config/settings.py | 4 +- content_manager/migrations/0001_initial.py | 128 +++++------------- .../migrations/0002_alter_contentpage_body.py | 128 +++++------------- .../migrations/0003_alter_contentpage_body.py | 120 ++++------------ .../migrations/0004_alter_contentpage_body.py | 120 ++++------------ content_manager/models.py | 24 +--- pyproject.toml | 2 + 7 files changed, 133 insertions(+), 393 deletions(-) create mode 100644 pyproject.toml diff --git a/config/settings.py b/config/settings.py index c6ab47d0..face102b 100644 --- a/config/settings.py +++ b/config/settings.py @@ -163,9 +163,7 @@ AWS_S3_ACCESS_KEY_ID = os.getenv("S3_KEY_ID", "123") AWS_S3_SECRET_ACCESS_KEY = os.getenv("S3_KEY_SECRET", "secret") -AWS_S3_ENDPOINT_URL = ( - f"{os.getenv('S3_PROTOCOL', 'https')}://{os.getenv('S3_HOST', 'set-var-env.com/')}" -) +AWS_S3_ENDPOINT_URL = f"{os.getenv('S3_PROTOCOL', 'https')}://{os.getenv('S3_HOST', 'set-var-env.com/')}" AWS_STORAGE_BUCKET_NAME = os.getenv("S3_BUCKET_NAME", "set-bucket-name") AWS_S3_STORAGE_BUCKET_REGION = os.getenv("S3_BUCKET_REGION", "fr") diff --git a/content_manager/migrations/0001_initial.py b/content_manager/migrations/0001_initial.py index 1b5ec54c..65b84ff3 100644 --- a/content_manager/migrations/0001_initial.py +++ b/content_manager/migrations/0001_initial.py @@ -45,9 +45,7 @@ class Migration(migrations.Migration): ), ( "large", - wagtail.blocks.BooleanBlock( - label="Large", required=False - ), + wagtail.blocks.BooleanBlock(label="Large", required=False), ), ], label="Titre de page", @@ -55,15 +53,11 @@ class Migration(migrations.Migration): ), ( "paragraph", - wagtail.blocks.RichTextBlock( - label="Texte avec mise en forme" - ), + wagtail.blocks.RichTextBlock(label="Texte avec mise en forme"), ), ( "paragraphlarge", - wagtail.blocks.RichTextBlock( - label="Texte avec mise en forme (large)" - ), + wagtail.blocks.RichTextBlock(label="Texte avec mise en forme (large)"), ), ( "image", @@ -71,15 +65,11 @@ class Migration(migrations.Migration): [ ( "title", - wagtail.blocks.CharBlock( - label="Titre", required=False - ), + wagtail.blocks.CharBlock(label="Titre", required=False), ), ( "image", - wagtail.images.blocks.ImageChooserBlock( - label="Illustration" - ), + wagtail.images.blocks.ImageChooserBlock(label="Illustration"), ), ( "alt", @@ -90,15 +80,11 @@ class Migration(migrations.Migration): ), ( "caption", - wagtail.blocks.CharBlock( - label="Légende", required=False - ), + wagtail.blocks.CharBlock(label="Légende", required=False), ), ( "url", - wagtail.blocks.URLBlock( - label="Lien", required=False - ), + wagtail.blocks.URLBlock(label="Lien", required=False), ), ] ), @@ -109,9 +95,7 @@ class Migration(migrations.Migration): [ ( "image", - wagtail.images.blocks.ImageChooserBlock( - label="Illustration (à gauche)" - ), + wagtail.images.blocks.ImageChooserBlock(label="Illustration (à gauche)"), ), ( "image_ratio", @@ -126,9 +110,7 @@ class Migration(migrations.Migration): ), ( "text", - wagtail.blocks.RichTextBlock( - label="Texte avec mise en forme (à droite)" - ), + wagtail.blocks.RichTextBlock(label="Texte avec mise en forme (à droite)"), ), ( "link_label", @@ -140,9 +122,7 @@ class Migration(migrations.Migration): ), ( "link_url", - wagtail.blocks.URLBlock( - label="Lien", required=False - ), + wagtail.blocks.URLBlock(label="Lien", required=False), ), ], label="Bloc image à gauche et texte à droite", @@ -154,15 +134,11 @@ class Migration(migrations.Migration): [ ( "title", - wagtail.blocks.CharBlock( - label="Titre du message", required=False - ), + wagtail.blocks.CharBlock(label="Titre du message", required=False), ), ( "description", - wagtail.blocks.TextBlock( - label="Texte du message", required=False - ), + wagtail.blocks.TextBlock(label="Texte du message", required=False), ), ( "level", @@ -219,15 +195,11 @@ class Migration(migrations.Migration): ), ( "author_name", - wagtail.blocks.CharBlock( - label="Nom de l'auteur" - ), + wagtail.blocks.CharBlock(label="Nom de l'auteur"), ), ( "author_title", - wagtail.blocks.CharBlock( - label="Titre de l'auteur" - ), + wagtail.blocks.CharBlock(label="Titre de l'auteur"), ), ], label="Citation", @@ -239,9 +211,7 @@ class Migration(migrations.Migration): [ ( "title", - wagtail.blocks.CharBlock( - label="Titre", required=False - ), + wagtail.blocks.CharBlock(label="Titre", required=False), ), ( "caption", @@ -267,9 +237,7 @@ class Migration(migrations.Migration): [ ( "text", - wagtail.blocks.RichTextBlock( - label="Texte avec mise en forme" - ), + wagtail.blocks.RichTextBlock(label="Texte avec mise en forme"), ), ( "image", @@ -284,9 +252,7 @@ class Migration(migrations.Migration): ), ( "image", - wagtail.images.blocks.ImageChooserBlock( - label="Illustration" - ), + wagtail.images.blocks.ImageChooserBlock(label="Illustration"), ), ( "alt", @@ -306,9 +272,7 @@ class Migration(migrations.Migration): ), ( "url", - wagtail.blocks.URLBlock( - label="Lien", required=False - ), + wagtail.blocks.URLBlock(label="Lien", required=False), ), ], label="Image", @@ -327,9 +291,7 @@ class Migration(migrations.Migration): ), ( "caption", - wagtail.blocks.CharBlock( - label="Légende" - ), + wagtail.blocks.CharBlock(label="Légende"), ), ( "url", @@ -351,27 +313,19 @@ class Migration(migrations.Migration): [ ( "title", - wagtail.blocks.CharBlock( - label="Titre" - ), + wagtail.blocks.CharBlock(label="Titre"), ), ( "description", - wagtail.blocks.TextBlock( - label="Texte" - ), + wagtail.blocks.TextBlock(label="Texte"), ), ( "image", - wagtail.images.blocks.ImageChooserBlock( - label="Image" - ), + wagtail.images.blocks.ImageChooserBlock(label="Image"), ), ( "url", - wagtail.blocks.URLBlock( - label="Lien", required=False - ), + wagtail.blocks.URLBlock(label="Lien", required=False), ), ( "document", @@ -402,21 +356,15 @@ class Migration(migrations.Migration): ), ( "quote", - wagtail.blocks.CharBlock( - label="Citation" - ), + wagtail.blocks.CharBlock(label="Citation"), ), ( "author_name", - wagtail.blocks.CharBlock( - label="Nom de l'auteur" - ), + wagtail.blocks.CharBlock(label="Nom de l'auteur"), ), ( "author_title", - wagtail.blocks.CharBlock( - label="Titre de l'auteur" - ), + wagtail.blocks.CharBlock(label="Titre de l'auteur"), ), ], label="Citation", @@ -440,15 +388,11 @@ class Migration(migrations.Migration): [ ( "title", - wagtail.blocks.CharBlock( - label="Titre" - ), + wagtail.blocks.CharBlock(label="Titre"), ), ( "content", - wagtail.blocks.RichTextBlock( - label="Contenu" - ), + wagtail.blocks.RichTextBlock(label="Contenu"), ), ], label="Accordéon", @@ -470,15 +414,11 @@ class Migration(migrations.Migration): ), ( "total", - wagtail.blocks.IntegerBlock( - label="Nombre d'étape" - ), + wagtail.blocks.IntegerBlock(label="Nombre d'étape"), ), ( "current", - wagtail.blocks.IntegerBlock( - label="Étape en cours" - ), + wagtail.blocks.IntegerBlock(label="Étape en cours"), ), ( "steps", @@ -490,15 +430,11 @@ class Migration(migrations.Migration): [ ( "title", - wagtail.blocks.CharBlock( - label="Titre de l'étape" - ), + wagtail.blocks.CharBlock(label="Titre de l'étape"), ), ( "detail", - wagtail.blocks.TextBlock( - label="Détail" - ), + wagtail.blocks.TextBlock(label="Détail"), ), ], label="Étape", diff --git a/content_manager/migrations/0002_alter_contentpage_body.py b/content_manager/migrations/0002_alter_contentpage_body.py index c6287962..e33543a8 100644 --- a/content_manager/migrations/0002_alter_contentpage_body.py +++ b/content_manager/migrations/0002_alter_contentpage_body.py @@ -25,9 +25,7 @@ class Migration(migrations.Migration): [ ( "bg_image", - wagtail.images.blocks.ImageChooserBlock( - label="Image d'arrière plan" - ), + wagtail.images.blocks.ImageChooserBlock(label="Image d'arrière plan"), ), ( "bg_color", @@ -45,15 +43,11 @@ class Migration(migrations.Migration): ("title", wagtail.blocks.CharBlock(label="Titre")), ( "cta_label", - wagtail.blocks.CharBlock( - label="Texte du bouton", required=False - ), + wagtail.blocks.CharBlock(label="Texte du bouton", required=False), ), ( "cta_link", - wagtail.blocks.URLBlock( - label="Lien du bouton", required=False - ), + wagtail.blocks.URLBlock(label="Lien du bouton", required=False), ), ], label="Section promotionnelle", @@ -66,9 +60,7 @@ class Migration(migrations.Migration): ("title", wagtail.blocks.CharBlock(label="Titre")), ( "large", - wagtail.blocks.BooleanBlock( - label="Large", required=False - ), + wagtail.blocks.BooleanBlock(label="Large", required=False), ), ], label="Titre de page", @@ -80,9 +72,7 @@ class Migration(migrations.Migration): ), ( "paragraphlarge", - wagtail.blocks.RichTextBlock( - label="Texte avec mise en forme (large)" - ), + wagtail.blocks.RichTextBlock(label="Texte avec mise en forme (large)"), ), ( "image", @@ -90,15 +80,11 @@ class Migration(migrations.Migration): [ ( "title", - wagtail.blocks.CharBlock( - label="Titre", required=False - ), + wagtail.blocks.CharBlock(label="Titre", required=False), ), ( "image", - wagtail.images.blocks.ImageChooserBlock( - label="Illustration" - ), + wagtail.images.blocks.ImageChooserBlock(label="Illustration"), ), ( "alt", @@ -109,15 +95,11 @@ class Migration(migrations.Migration): ), ( "caption", - wagtail.blocks.CharBlock( - label="Légende", required=False - ), + wagtail.blocks.CharBlock(label="Légende", required=False), ), ( "url", - wagtail.blocks.URLBlock( - label="Lien", required=False - ), + wagtail.blocks.URLBlock(label="Lien", required=False), ), ] ), @@ -128,9 +110,7 @@ class Migration(migrations.Migration): [ ( "image", - wagtail.images.blocks.ImageChooserBlock( - label="Illustration (à gauche)" - ), + wagtail.images.blocks.ImageChooserBlock(label="Illustration (à gauche)"), ), ( "image_ratio", @@ -145,9 +125,7 @@ class Migration(migrations.Migration): ), ( "text", - wagtail.blocks.RichTextBlock( - label="Texte avec mise en forme (à droite)" - ), + wagtail.blocks.RichTextBlock(label="Texte avec mise en forme (à droite)"), ), ( "link_label", @@ -159,9 +137,7 @@ class Migration(migrations.Migration): ), ( "link_url", - wagtail.blocks.URLBlock( - label="Lien", required=False - ), + wagtail.blocks.URLBlock(label="Lien", required=False), ), ], label="Bloc image à gauche et texte à droite", @@ -173,15 +149,11 @@ class Migration(migrations.Migration): [ ( "title", - wagtail.blocks.CharBlock( - label="Titre du message", required=False - ), + wagtail.blocks.CharBlock(label="Titre du message", required=False), ), ( "description", - wagtail.blocks.TextBlock( - label="Texte du message", required=False - ), + wagtail.blocks.TextBlock(label="Texte du message", required=False), ), ( "level", @@ -205,15 +177,11 @@ class Migration(migrations.Migration): [ ( "title", - wagtail.blocks.CharBlock( - label="Titre de la mise en vant", required=False - ), + wagtail.blocks.CharBlock(label="Titre de la mise en vant", required=False), ), ( "text", - wagtail.blocks.TextBlock( - label="Texte mis en avant", required=False - ), + wagtail.blocks.TextBlock(label="Texte mis en avant", required=False), ), ], label="Texte mise en avant", @@ -248,9 +216,7 @@ class Migration(migrations.Migration): [ ( "title", - wagtail.blocks.CharBlock( - label="Titre", required=False - ), + wagtail.blocks.CharBlock(label="Titre", required=False), ), ("caption", wagtail.blocks.CharBlock(label="Légende")), ( @@ -273,9 +239,7 @@ class Migration(migrations.Migration): [ ( "text", - wagtail.blocks.RichTextBlock( - label="Texte avec mise en forme" - ), + wagtail.blocks.RichTextBlock(label="Texte avec mise en forme"), ), ( "image", @@ -283,15 +247,11 @@ class Migration(migrations.Migration): [ ( "title", - wagtail.blocks.CharBlock( - label="Titre", required=False - ), + wagtail.blocks.CharBlock(label="Titre", required=False), ), ( "image", - wagtail.images.blocks.ImageChooserBlock( - label="Illustration" - ), + wagtail.images.blocks.ImageChooserBlock(label="Illustration"), ), ( "alt", @@ -302,15 +262,11 @@ class Migration(migrations.Migration): ), ( "caption", - wagtail.blocks.CharBlock( - label="Légende", required=False - ), + wagtail.blocks.CharBlock(label="Légende", required=False), ), ( "url", - wagtail.blocks.URLBlock( - label="Lien", required=False - ), + wagtail.blocks.URLBlock(label="Lien", required=False), ), ], label="Image", @@ -322,15 +278,11 @@ class Migration(migrations.Migration): [ ( "title", - wagtail.blocks.CharBlock( - label="Titre", required=False - ), + wagtail.blocks.CharBlock(label="Titre", required=False), ), ( "caption", - wagtail.blocks.CharBlock( - label="Légende" - ), + wagtail.blocks.CharBlock(label="Légende"), ), ( "url", @@ -360,15 +312,11 @@ class Migration(migrations.Migration): ), ( "image", - wagtail.images.blocks.ImageChooserBlock( - label="Image" - ), + wagtail.images.blocks.ImageChooserBlock(label="Image"), ), ( "url", - wagtail.blocks.URLBlock( - label="Lien", required=False - ), + wagtail.blocks.URLBlock(label="Lien", required=False), ), ( "document", @@ -398,21 +346,15 @@ class Migration(migrations.Migration): ), ( "quote", - wagtail.blocks.CharBlock( - label="Citation" - ), + wagtail.blocks.CharBlock(label="Citation"), ), ( "author_name", - wagtail.blocks.CharBlock( - label="Nom de l'auteur" - ), + wagtail.blocks.CharBlock(label="Nom de l'auteur"), ), ( "author_title", - wagtail.blocks.CharBlock( - label="Titre de l'auteur" - ), + wagtail.blocks.CharBlock(label="Titre de l'auteur"), ), ], label="Citation", @@ -437,9 +379,7 @@ class Migration(migrations.Migration): ), ( "content", - wagtail.blocks.RichTextBlock( - label="Contenu" - ), + wagtail.blocks.RichTextBlock(label="Contenu"), ), ], label="Accordéon", @@ -474,15 +414,11 @@ class Migration(migrations.Migration): [ ( "title", - wagtail.blocks.CharBlock( - label="Titre de l'étape" - ), + wagtail.blocks.CharBlock(label="Titre de l'étape"), ), ( "detail", - wagtail.blocks.TextBlock( - label="Détail" - ), + wagtail.blocks.TextBlock(label="Détail"), ), ], label="Étape", diff --git a/content_manager/migrations/0003_alter_contentpage_body.py b/content_manager/migrations/0003_alter_contentpage_body.py index 2b9a1edb..ad4c89b1 100644 --- a/content_manager/migrations/0003_alter_contentpage_body.py +++ b/content_manager/migrations/0003_alter_contentpage_body.py @@ -25,9 +25,7 @@ class Migration(migrations.Migration): [ ( "bg_image", - wagtail.images.blocks.ImageChooserBlock( - label="Image d'arrière plan" - ), + wagtail.images.blocks.ImageChooserBlock(label="Image d'arrière plan"), ), ( "bg_color", @@ -45,21 +43,15 @@ class Migration(migrations.Migration): ("title", wagtail.blocks.CharBlock(label="Titre")), ( "text", - wagtail.blocks.CharBlock( - label="Texte", required=False - ), + wagtail.blocks.CharBlock(label="Texte", required=False), ), ( "cta_label", - wagtail.blocks.CharBlock( - label="Texte du bouton", required=False - ), + wagtail.blocks.CharBlock(label="Texte du bouton", required=False), ), ( "cta_link", - wagtail.blocks.URLBlock( - label="Lien du bouton", required=False - ), + wagtail.blocks.URLBlock(label="Lien du bouton", required=False), ), ], label="Section promotionnelle", @@ -72,9 +64,7 @@ class Migration(migrations.Migration): ("title", wagtail.blocks.CharBlock(label="Titre")), ( "large", - wagtail.blocks.BooleanBlock( - label="Large", required=False - ), + wagtail.blocks.BooleanBlock(label="Large", required=False), ), ], label="Titre de page", @@ -86,9 +76,7 @@ class Migration(migrations.Migration): ), ( "paragraphlarge", - wagtail.blocks.RichTextBlock( - label="Texte avec mise en forme (large)" - ), + wagtail.blocks.RichTextBlock(label="Texte avec mise en forme (large)"), ), ( "image", @@ -96,15 +84,11 @@ class Migration(migrations.Migration): [ ( "title", - wagtail.blocks.CharBlock( - label="Titre", required=False - ), + wagtail.blocks.CharBlock(label="Titre", required=False), ), ( "image", - wagtail.images.blocks.ImageChooserBlock( - label="Illustration" - ), + wagtail.images.blocks.ImageChooserBlock(label="Illustration"), ), ( "alt", @@ -115,15 +99,11 @@ class Migration(migrations.Migration): ), ( "caption", - wagtail.blocks.CharBlock( - label="Légende", required=False - ), + wagtail.blocks.CharBlock(label="Légende", required=False), ), ( "url", - wagtail.blocks.URLBlock( - label="Lien", required=False - ), + wagtail.blocks.URLBlock(label="Lien", required=False), ), ] ), @@ -134,9 +114,7 @@ class Migration(migrations.Migration): [ ( "image", - wagtail.images.blocks.ImageChooserBlock( - label="Illustration (à gauche)" - ), + wagtail.images.blocks.ImageChooserBlock(label="Illustration (à gauche)"), ), ( "image_ratio", @@ -151,9 +129,7 @@ class Migration(migrations.Migration): ), ( "text", - wagtail.blocks.RichTextBlock( - label="Texte avec mise en forme (à droite)" - ), + wagtail.blocks.RichTextBlock(label="Texte avec mise en forme (à droite)"), ), ( "link_label", @@ -165,9 +141,7 @@ class Migration(migrations.Migration): ), ( "link_url", - wagtail.blocks.URLBlock( - label="Lien", required=False - ), + wagtail.blocks.URLBlock(label="Lien", required=False), ), ], label="Bloc image à gauche et texte à droite", @@ -179,15 +153,11 @@ class Migration(migrations.Migration): [ ( "title", - wagtail.blocks.CharBlock( - label="Titre du message", required=False - ), + wagtail.blocks.CharBlock(label="Titre du message", required=False), ), ( "description", - wagtail.blocks.TextBlock( - label="Texte du message", required=False - ), + wagtail.blocks.TextBlock(label="Texte du message", required=False), ), ( "level", @@ -211,15 +181,11 @@ class Migration(migrations.Migration): [ ( "title", - wagtail.blocks.CharBlock( - label="Titre de la mise en vant", required=False - ), + wagtail.blocks.CharBlock(label="Titre de la mise en vant", required=False), ), ( "text", - wagtail.blocks.TextBlock( - label="Texte mis en avant", required=False - ), + wagtail.blocks.TextBlock(label="Texte mis en avant", required=False), ), ], label="Texte mise en avant", @@ -254,9 +220,7 @@ class Migration(migrations.Migration): [ ( "title", - wagtail.blocks.CharBlock( - label="Titre", required=False - ), + wagtail.blocks.CharBlock(label="Titre", required=False), ), ("caption", wagtail.blocks.CharBlock(label="Légende")), ( @@ -297,9 +261,7 @@ class Migration(migrations.Migration): ), ( "title", - wagtail.blocks.CharBlock( - label="Titre", required=False - ), + wagtail.blocks.CharBlock(label="Titre", required=False), ), ( "columns", @@ -307,9 +269,7 @@ class Migration(migrations.Migration): [ ( "text", - wagtail.blocks.RichTextBlock( - label="Texte avec mise en forme" - ), + wagtail.blocks.RichTextBlock(label="Texte avec mise en forme"), ), ( "image", @@ -369,9 +329,7 @@ class Migration(migrations.Migration): ), ( "caption", - wagtail.blocks.CharBlock( - label="Légende" - ), + wagtail.blocks.CharBlock(label="Légende"), ), ( "url", @@ -393,21 +351,15 @@ class Migration(migrations.Migration): [ ( "title", - wagtail.blocks.CharBlock( - label="Titre" - ), + wagtail.blocks.CharBlock(label="Titre"), ), ( "description", - wagtail.blocks.TextBlock( - label="Texte" - ), + wagtail.blocks.TextBlock(label="Texte"), ), ( "image", - wagtail.images.blocks.ImageChooserBlock( - label="Image" - ), + wagtail.images.blocks.ImageChooserBlock(label="Image"), ), ( "url", @@ -445,21 +397,15 @@ class Migration(migrations.Migration): ), ( "quote", - wagtail.blocks.CharBlock( - label="Citation" - ), + wagtail.blocks.CharBlock(label="Citation"), ), ( "author_name", - wagtail.blocks.CharBlock( - label="Nom de l'auteur" - ), + wagtail.blocks.CharBlock(label="Nom de l'auteur"), ), ( "author_title", - wagtail.blocks.CharBlock( - label="Titre de l'auteur" - ), + wagtail.blocks.CharBlock(label="Titre de l'auteur"), ), ], label="Citation", @@ -488,9 +434,7 @@ class Migration(migrations.Migration): ), ( "content", - wagtail.blocks.RichTextBlock( - label="Contenu" - ), + wagtail.blocks.RichTextBlock(label="Contenu"), ), ], label="Accordéon", @@ -525,15 +469,11 @@ class Migration(migrations.Migration): [ ( "title", - wagtail.blocks.CharBlock( - label="Titre de l'étape" - ), + wagtail.blocks.CharBlock(label="Titre de l'étape"), ), ( "detail", - wagtail.blocks.TextBlock( - label="Détail" - ), + wagtail.blocks.TextBlock(label="Détail"), ), ], label="Étape", diff --git a/content_manager/migrations/0004_alter_contentpage_body.py b/content_manager/migrations/0004_alter_contentpage_body.py index 03487c9f..b9b67064 100644 --- a/content_manager/migrations/0004_alter_contentpage_body.py +++ b/content_manager/migrations/0004_alter_contentpage_body.py @@ -25,9 +25,7 @@ class Migration(migrations.Migration): [ ( "bg_image", - wagtail.images.blocks.ImageChooserBlock( - label="Image d'arrière plan" - ), + wagtail.images.blocks.ImageChooserBlock(label="Image d'arrière plan"), ), ( "bg_color", @@ -43,21 +41,15 @@ class Migration(migrations.Migration): ("title", wagtail.blocks.CharBlock(label="Titre")), ( "text", - wagtail.blocks.CharBlock( - label="Texte", required=False - ), + wagtail.blocks.CharBlock(label="Texte", required=False), ), ( "cta_label", - wagtail.blocks.CharBlock( - label="Texte du bouton", required=False - ), + wagtail.blocks.CharBlock(label="Texte du bouton", required=False), ), ( "cta_link", - wagtail.blocks.URLBlock( - label="Lien du bouton", required=False - ), + wagtail.blocks.URLBlock(label="Lien du bouton", required=False), ), ], label="Section promotionnelle", @@ -70,9 +62,7 @@ class Migration(migrations.Migration): ("title", wagtail.blocks.CharBlock(label="Titre")), ( "large", - wagtail.blocks.BooleanBlock( - label="Large", required=False - ), + wagtail.blocks.BooleanBlock(label="Large", required=False), ), ], label="Titre de page", @@ -84,9 +74,7 @@ class Migration(migrations.Migration): ), ( "paragraphlarge", - wagtail.blocks.RichTextBlock( - label="Texte avec mise en forme (large)" - ), + wagtail.blocks.RichTextBlock(label="Texte avec mise en forme (large)"), ), ( "image", @@ -94,15 +82,11 @@ class Migration(migrations.Migration): [ ( "title", - wagtail.blocks.CharBlock( - label="Titre", required=False - ), + wagtail.blocks.CharBlock(label="Titre", required=False), ), ( "image", - wagtail.images.blocks.ImageChooserBlock( - label="Illustration" - ), + wagtail.images.blocks.ImageChooserBlock(label="Illustration"), ), ( "alt", @@ -113,15 +97,11 @@ class Migration(migrations.Migration): ), ( "caption", - wagtail.blocks.CharBlock( - label="Légende", required=False - ), + wagtail.blocks.CharBlock(label="Légende", required=False), ), ( "url", - wagtail.blocks.URLBlock( - label="Lien", required=False - ), + wagtail.blocks.URLBlock(label="Lien", required=False), ), ] ), @@ -132,9 +112,7 @@ class Migration(migrations.Migration): [ ( "image", - wagtail.images.blocks.ImageChooserBlock( - label="Illustration (à gauche)" - ), + wagtail.images.blocks.ImageChooserBlock(label="Illustration (à gauche)"), ), ( "image_ratio", @@ -149,9 +127,7 @@ class Migration(migrations.Migration): ), ( "text", - wagtail.blocks.RichTextBlock( - label="Texte avec mise en forme (à droite)" - ), + wagtail.blocks.RichTextBlock(label="Texte avec mise en forme (à droite)"), ), ( "link_label", @@ -163,9 +139,7 @@ class Migration(migrations.Migration): ), ( "link_url", - wagtail.blocks.URLBlock( - label="Lien", required=False - ), + wagtail.blocks.URLBlock(label="Lien", required=False), ), ], label="Bloc image à gauche et texte à droite", @@ -177,15 +151,11 @@ class Migration(migrations.Migration): [ ( "title", - wagtail.blocks.CharBlock( - label="Titre du message", required=False - ), + wagtail.blocks.CharBlock(label="Titre du message", required=False), ), ( "description", - wagtail.blocks.TextBlock( - label="Texte du message", required=False - ), + wagtail.blocks.TextBlock(label="Texte du message", required=False), ), ( "level", @@ -209,15 +179,11 @@ class Migration(migrations.Migration): [ ( "title", - wagtail.blocks.CharBlock( - label="Titre de la mise en vant", required=False - ), + wagtail.blocks.CharBlock(label="Titre de la mise en vant", required=False), ), ( "text", - wagtail.blocks.TextBlock( - label="Texte mis en avant", required=False - ), + wagtail.blocks.TextBlock(label="Texte mis en avant", required=False), ), ], label="Texte mise en avant", @@ -252,9 +218,7 @@ class Migration(migrations.Migration): [ ( "title", - wagtail.blocks.CharBlock( - label="Titre", required=False - ), + wagtail.blocks.CharBlock(label="Titre", required=False), ), ("caption", wagtail.blocks.CharBlock(label="Légende")), ( @@ -291,9 +255,7 @@ class Migration(migrations.Migration): ), ( "title", - wagtail.blocks.CharBlock( - label="Titre", required=False - ), + wagtail.blocks.CharBlock(label="Titre", required=False), ), ( "columns", @@ -301,9 +263,7 @@ class Migration(migrations.Migration): [ ( "text", - wagtail.blocks.RichTextBlock( - label="Texte avec mise en forme" - ), + wagtail.blocks.RichTextBlock(label="Texte avec mise en forme"), ), ( "image", @@ -360,9 +320,7 @@ class Migration(migrations.Migration): ), ( "caption", - wagtail.blocks.CharBlock( - label="Légende" - ), + wagtail.blocks.CharBlock(label="Légende"), ), ( "url", @@ -381,21 +339,15 @@ class Migration(migrations.Migration): [ ( "title", - wagtail.blocks.CharBlock( - label="Titre" - ), + wagtail.blocks.CharBlock(label="Titre"), ), ( "description", - wagtail.blocks.TextBlock( - label="Texte" - ), + wagtail.blocks.TextBlock(label="Texte"), ), ( "image", - wagtail.images.blocks.ImageChooserBlock( - label="Image" - ), + wagtail.images.blocks.ImageChooserBlock(label="Image"), ), ( "url", @@ -429,21 +381,15 @@ class Migration(migrations.Migration): ), ( "quote", - wagtail.blocks.CharBlock( - label="Citation" - ), + wagtail.blocks.CharBlock(label="Citation"), ), ( "author_name", - wagtail.blocks.CharBlock( - label="Nom de l'auteur" - ), + wagtail.blocks.CharBlock(label="Nom de l'auteur"), ), ( "author_title", - wagtail.blocks.CharBlock( - label="Titre de l'auteur" - ), + wagtail.blocks.CharBlock(label="Titre de l'auteur"), ), ], label="Citation", @@ -502,9 +448,7 @@ class Migration(migrations.Migration): ), ( "content", - wagtail.blocks.RichTextBlock( - label="Contenu" - ), + wagtail.blocks.RichTextBlock(label="Contenu"), ), ], label="Accordéon", @@ -539,15 +483,11 @@ class Migration(migrations.Migration): [ ( "title", - wagtail.blocks.CharBlock( - label="Titre de l'étape" - ), + wagtail.blocks.CharBlock(label="Titre de l'étape"), ), ( "detail", - wagtail.blocks.TextBlock( - label="Détail" - ), + wagtail.blocks.TextBlock(label="Détail"), ), ], label="Étape", diff --git a/content_manager/models.py b/content_manager/models.py index 59f50a91..b35c6c9f 100644 --- a/content_manager/models.py +++ b/content_manager/models.py @@ -13,9 +13,7 @@ class HeroBlock(blocks.StructBlock): bg_color = blocks.RegexBlock( label="Couleur d'arrière plan au format hexa (Ex: #f5f5fe)", regex=r"^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$", - error_messages={ - "invalid": "La couleur n'est pas correcte, le format doit être #fff ou #f5f5fe" - }, + error_messages={"invalid": "La couleur n'est pas correcte, le format doit être #fff ou #f5f5fe"}, required=False, ) title = blocks.CharBlock(label="Titre") @@ -32,9 +30,7 @@ class TitleBlock(blocks.StructBlock): class ImageBlock(blocks.StructBlock): title = blocks.CharBlock(label="Titre", required=False) image = ImageChooserBlock(label="Illustration") - alt = blocks.CharBlock( - label="Texte alternatif (description textuelle de l'image)", required=False - ) + alt = blocks.CharBlock(label="Texte alternatif (description textuelle de l'image)", required=False) caption = blocks.CharBlock(label="Légende", required=False) url = blocks.URLBlock(label="Lien", required=False) @@ -129,9 +125,7 @@ class CardBlock(blocks.StructBlock): class BadgeBlock(blocks.StructBlock): text = blocks.CharBlock(label="Texte du badge", required=False) - color = blocks.ChoiceBlock( - label="Couleur de badge", choices=badge_level_choices, required=False - ) + color = blocks.ChoiceBlock(label="Couleur de badge", choices=badge_level_choices, required=False) hide_icon = blocks.BooleanBlock(label="Masquer l'icon du badge", required=False) @@ -163,9 +157,7 @@ class MultiColumnsWithTitleBlock(blocks.StructBlock): bg_color = blocks.RegexBlock( label="Couleur d'arrière plan au format hexa (Ex: #f5f5fe)", regex=r"^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$", - error_messages={ - "invalid": "La couleur n'est pas correcte, le format doit être #fff ou #f5f5fe" - }, + error_messages={"invalid": "La couleur n'est pas correcte, le format doit être #fff ou #f5f5fe"}, required=False, ) title = blocks.CharBlock(label="Titre", required=False) @@ -199,12 +191,8 @@ class StepperBlock(blocks.StructBlock): class SeparatorBlock(blocks.StructBlock): - top_margin = blocks.IntegerBlock( - label="Espacement au dessus", min_value=0, max_value=15, default=3 - ) - bottom_margin = blocks.IntegerBlock( - label="Espacement en dessous", min_value=0, max_value=15, default=3 - ) + top_margin = blocks.IntegerBlock(label="Espacement au dessus", min_value=0, max_value=15, default=3) + bottom_margin = blocks.IntegerBlock(label="Espacement en dessous", min_value=0, max_value=15, default=3) class ContentPage(Page): diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 00000000..0bcf8273 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,2 @@ +[tool.black] +line_length = 119 From 4a04b47248e3587c074abb013a60427298462bd1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Reuiller?= Date: Thu, 6 Apr 2023 11:51:57 +0200 Subject: [PATCH 03/13] update black --- content_manager/migrations/0001_initial.py | 1 - .../migrations/0002_alter_contentpage_body.py | 1 - .../migrations/0003_alter_contentpage_body.py | 1 - .../migrations/0004_alter_contentpage_body.py | 35 ++++++++++++++----- requirements.txt | 2 +- 5 files changed, 28 insertions(+), 12 deletions(-) diff --git a/content_manager/migrations/0001_initial.py b/content_manager/migrations/0001_initial.py index 65b84ff3..f157f352 100644 --- a/content_manager/migrations/0001_initial.py +++ b/content_manager/migrations/0001_initial.py @@ -9,7 +9,6 @@ class Migration(migrations.Migration): - initial = True dependencies = [ diff --git a/content_manager/migrations/0002_alter_contentpage_body.py b/content_manager/migrations/0002_alter_contentpage_body.py index e33543a8..30b905d8 100644 --- a/content_manager/migrations/0002_alter_contentpage_body.py +++ b/content_manager/migrations/0002_alter_contentpage_body.py @@ -8,7 +8,6 @@ class Migration(migrations.Migration): - dependencies = [ ("content_manager", "0001_initial"), ] diff --git a/content_manager/migrations/0003_alter_contentpage_body.py b/content_manager/migrations/0003_alter_contentpage_body.py index ad4c89b1..e9e2648b 100644 --- a/content_manager/migrations/0003_alter_contentpage_body.py +++ b/content_manager/migrations/0003_alter_contentpage_body.py @@ -8,7 +8,6 @@ class Migration(migrations.Migration): - dependencies = [ ("content_manager", "0002_alter_contentpage_body"), ] diff --git a/content_manager/migrations/0004_alter_contentpage_body.py b/content_manager/migrations/0004_alter_contentpage_body.py index b9b67064..5eb6bc5b 100644 --- a/content_manager/migrations/0004_alter_contentpage_body.py +++ b/content_manager/migrations/0004_alter_contentpage_body.py @@ -8,7 +8,6 @@ class Migration(migrations.Migration): - dependencies = [ ("content_manager", "0003_alter_contentpage_body"), ] @@ -31,7 +30,9 @@ class Migration(migrations.Migration): "bg_color", wagtail.blocks.RegexBlock( error_messages={ - "invalid": "La couleur n'est pas correcte, le format doit être #fff ou #f5f5fe" + "invalid": ( + "La couleur n'est pas correcte, le format doit être #fff ou #f5f5fe" + ) }, label="Couleur d'arrière plan au format hexa (Ex: #f5f5fe)", regex="^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$", @@ -224,7 +225,10 @@ class Migration(migrations.Migration): ( "url", wagtail.blocks.URLBlock( - help_text="URL au format 'embed' (Ex. : https://www.youtube.com/embed/gLzXOViPX-0)", + help_text=( + "URL au format 'embed' (Ex. : " + "https://www.youtube.com/embed/gLzXOViPX-0)" + ), label="Lien de la vidéo", ), ), @@ -246,7 +250,9 @@ class Migration(migrations.Migration): "bg_color", wagtail.blocks.RegexBlock( error_messages={ - "invalid": "La couleur n'est pas correcte, le format doit être #fff ou #f5f5fe" + "invalid": ( + "La couleur n'est pas correcte, le format doit " "être #fff ou #f5f5fe" + ) }, label="Couleur d'arrière plan au format hexa (Ex: #f5f5fe)", regex="^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$", @@ -285,7 +291,10 @@ class Migration(migrations.Migration): ( "alt", wagtail.blocks.CharBlock( - label="Texte alternatif (description textuelle de l'image)", + label=( + "Texte alternatif (description " + "textuelle de l'image)" + ), required=False, ), ), @@ -325,7 +334,10 @@ class Migration(migrations.Migration): ( "url", wagtail.blocks.URLBlock( - help_text="URL au format 'embed' (Ex. : https://www.youtube.com/embed/gLzXOViPX-0)", + help_text=( + "URL au format 'embed' " + "(Ex. : https://www.youtube.com/embed/gLzXOViPX-0)" + ), label="Lien de la vidéo", ), ), @@ -359,7 +371,11 @@ class Migration(migrations.Migration): ( "document", wagtail.documents.blocks.DocumentChooserBlock( - help_text="Sélectionnez un document pour rendre la carte cliquable vers celui ci (si le champ `Lien` n'est pas renseigné).", + help_text=( + "Sélectionnez un document pour rendre " + "la carte cliquable vers celui ci (si le " + "champ `Lien` n'est pas renseigné)." + ), label="ou Document", required=False, ), @@ -409,7 +425,10 @@ class Migration(migrations.Migration): ( "cta_label", wagtail.blocks.CharBlock( - help_text="Le lien apparait comme un bouton sous le bloc de texte", + help_text=( + "Le lien apparait comme un bouton sous " + "le bloc de texte" + ), label="Titre de l'appel à l'action", required=False, ), diff --git a/requirements.txt b/requirements.txt index 29bc3618..0a820f7b 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,7 +1,7 @@ dj-static==0.0.6 Django==4.1.5 django-dsfr==0.12.0 -black==22.12.0 +black==23.1.0 flake8==6.0.0 isort==5.11.4 pre-commit==2.20.0 From c65f080f3b027a7d8ded63ff045c924df41d5fec Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 6 Apr 2023 10:09:48 +0000 Subject: [PATCH 04/13] Bump django from 4.1.5 to 4.1.7 Bumps [django](https://github.com/django/django) from 4.1.5 to 4.1.7. - [Release notes](https://github.com/django/django/releases) - [Commits](https://github.com/django/django/compare/4.1.5...4.1.7) --- updated-dependencies: - dependency-name: django dependency-type: direct:production ... Signed-off-by: dependabot[bot] --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 0a820f7b..c1e5216f 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,5 +1,5 @@ dj-static==0.0.6 -Django==4.1.5 +Django==4.1.7 django-dsfr==0.12.0 black==23.1.0 flake8==6.0.0 From f33763b3cb689ec8477a20ff57db498ab4b2e54c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Reuiller?= Date: Thu, 20 Apr 2023 11:35:10 +0200 Subject: [PATCH 05/13] update black --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 0a820f7b..fa288269 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,7 +1,7 @@ dj-static==0.0.6 Django==4.1.5 django-dsfr==0.12.0 -black==23.1.0 +black==23.3.0 flake8==6.0.0 isort==5.11.4 pre-commit==2.20.0 From f722797377ca226087321bbe945103d85b285860 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Reuiller?= Date: Thu, 20 Apr 2023 11:36:21 +0200 Subject: [PATCH 06/13] add iframe block --- .../migrations/0005_alter_contentpage_body.py | 449 ++++++++++++++++++ content_manager/models.py | 13 + .../content_manager/blocks/multicolumns.html | 4 + 3 files changed, 466 insertions(+) create mode 100644 content_manager/migrations/0005_alter_contentpage_body.py diff --git a/content_manager/migrations/0005_alter_contentpage_body.py b/content_manager/migrations/0005_alter_contentpage_body.py new file mode 100644 index 00000000..89711e1e --- /dev/null +++ b/content_manager/migrations/0005_alter_contentpage_body.py @@ -0,0 +1,449 @@ +# Generated by Django 4.1.5 on 2023-04-20 09:23 + +from django.db import migrations +import wagtail.blocks +import wagtail.documents.blocks +import wagtail.fields +import wagtail.images.blocks + + +class Migration(migrations.Migration): + dependencies = [ + ("content_manager", "0004_alter_contentpage_body"), + ] + + operations = [ + migrations.AlterField( + model_name="contentpage", + name="body", + field=wagtail.fields.StreamField( + [ + ( + "hero", + wagtail.blocks.StructBlock( + [ + ("bg_image", wagtail.images.blocks.ImageChooserBlock(label="Image d'arrière plan")), + ( + "bg_color", + wagtail.blocks.RegexBlock( + error_messages={ + "invalid": ( + "La couleur n'est pas correcte, le format doit être #fff ou #f5f5fe" + ) + }, + label="Couleur d'arrière plan au format hexa (Ex: #f5f5fe)", + regex="^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$", + required=False, + ), + ), + ("title", wagtail.blocks.CharBlock(label="Titre")), + ("text", wagtail.blocks.CharBlock(label="Texte", required=False)), + ("cta_label", wagtail.blocks.CharBlock(label="Texte du bouton", required=False)), + ("cta_link", wagtail.blocks.URLBlock(label="Lien du bouton", required=False)), + ], + label="Section promotionnelle", + ), + ), + ( + "title", + wagtail.blocks.StructBlock( + [ + ("title", wagtail.blocks.CharBlock(label="Titre")), + ("large", wagtail.blocks.BooleanBlock(label="Large", required=False)), + ], + label="Titre de page", + ), + ), + ("paragraph", wagtail.blocks.RichTextBlock(label="Texte avec mise en forme")), + ("paragraphlarge", wagtail.blocks.RichTextBlock(label="Texte avec mise en forme (large)")), + ( + "image", + wagtail.blocks.StructBlock( + [ + ("title", wagtail.blocks.CharBlock(label="Titre", required=False)), + ("image", wagtail.images.blocks.ImageChooserBlock(label="Illustration")), + ( + "alt", + wagtail.blocks.CharBlock( + label="Texte alternatif (description textuelle de l'image)", required=False + ), + ), + ("caption", wagtail.blocks.CharBlock(label="Légende", required=False)), + ("url", wagtail.blocks.URLBlock(label="Lien", required=False)), + ] + ), + ), + ( + "imageandtext", + wagtail.blocks.StructBlock( + [ + ("image", wagtail.images.blocks.ImageChooserBlock(label="Illustration (à gauche)")), + ( + "image_ratio", + wagtail.blocks.ChoiceBlock( + choices=[("3", "3/12"), ("5", "5/12"), ("6", "6/12")], + label="Largeur de l'image", + ), + ), + ("text", wagtail.blocks.RichTextBlock(label="Texte avec mise en forme (à droite)")), + ( + "link_label", + wagtail.blocks.CharBlock( + help_text="Le lien apparait en bas du bloc de droite, avec une flèche", + label="Titre du lien", + required=False, + ), + ), + ("link_url", wagtail.blocks.URLBlock(label="Lien", required=False)), + ], + label="Bloc image à gauche et texte à droite", + ), + ), + ( + "alert", + wagtail.blocks.StructBlock( + [ + ("title", wagtail.blocks.CharBlock(label="Titre du message", required=False)), + ("description", wagtail.blocks.TextBlock(label="Texte du message", required=False)), + ( + "level", + wagtail.blocks.ChoiceBlock( + choices=[ + ("error", "Erreur"), + ("success", "Succès"), + ("info", "Information"), + ("warning", "Attention"), + ], + label="Type de message", + ), + ), + ], + label="Message d'alerte", + ), + ), + ( + "callout", + wagtail.blocks.StructBlock( + [ + ("title", wagtail.blocks.CharBlock(label="Titre de la mise en vant", required=False)), + ("text", wagtail.blocks.TextBlock(label="Texte mis en avant", required=False)), + ], + label="Texte mise en avant", + ), + ), + ( + "quote", + wagtail.blocks.StructBlock( + [ + ( + "image", + wagtail.images.blocks.ImageChooserBlock( + label="Illustration (à gauche)", required=False + ), + ), + ("quote", wagtail.blocks.CharBlock(label="Citation")), + ("author_name", wagtail.blocks.CharBlock(label="Nom de l'auteur")), + ("author_title", wagtail.blocks.CharBlock(label="Titre de l'auteur")), + ], + label="Citation", + ), + ), + ( + "video", + wagtail.blocks.StructBlock( + [ + ("title", wagtail.blocks.CharBlock(label="Titre", required=False)), + ("caption", wagtail.blocks.CharBlock(label="Légende")), + ( + "url", + wagtail.blocks.URLBlock( + help_text=( + "URL au format 'embed' (Ex. : https://www.youtube.com/embed/gLzXOViPX-0)" + ), + label="Lien de la vidéo", + ), + ), + ], + label="Vidéo", + ), + ), + ( + "multicolumns", + wagtail.blocks.StructBlock( + [ + ( + "bg_image", + wagtail.images.blocks.ImageChooserBlock( + label="Image d'arrière plan", required=False + ), + ), + ( + "bg_color", + wagtail.blocks.RegexBlock( + error_messages={ + "invalid": ( + "La couleur n'est pas correcte, le format doit être #fff ou #f5f5fe" + ) + }, + label="Couleur d'arrière plan au format hexa (Ex: #f5f5fe)", + regex="^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$", + required=False, + ), + ), + ("title", wagtail.blocks.CharBlock(label="Titre", required=False)), + ( + "columns", + wagtail.blocks.StreamBlock( + [ + ("text", wagtail.blocks.RichTextBlock(label="Texte avec mise en forme")), + ( + "image", + wagtail.blocks.StructBlock( + [ + ( + "title", + wagtail.blocks.CharBlock(label="Titre", required=False), + ), + ( + "image", + wagtail.images.blocks.ImageChooserBlock( + label="Illustration" + ), + ), + ( + "alt", + wagtail.blocks.CharBlock( + label=( + "Texte alternatif (description textuelle de" + " l'image)" + ), + required=False, + ), + ), + ( + "caption", + wagtail.blocks.CharBlock(label="Légende", required=False), + ), + ("url", wagtail.blocks.URLBlock(label="Lien", required=False)), + ], + label="Image", + ), + ), + ( + "video", + wagtail.blocks.StructBlock( + [ + ( + "title", + wagtail.blocks.CharBlock(label="Titre", required=False), + ), + ("caption", wagtail.blocks.CharBlock(label="Légende")), + ( + "url", + wagtail.blocks.URLBlock( + help_text=( + "URL au format 'embed' (Ex. :" + " https://www.youtube.com/embed/gLzXOViPX-0)" + ), + label="Lien de la vidéo", + ), + ), + ], + label="Vidéo", + ), + ), + ( + "card", + wagtail.blocks.StructBlock( + [ + ("title", wagtail.blocks.CharBlock(label="Titre")), + ("description", wagtail.blocks.TextBlock(label="Texte")), + ( + "image", + wagtail.images.blocks.ImageChooserBlock(label="Image"), + ), + ("url", wagtail.blocks.URLBlock(label="Lien", required=False)), + ( + "document", + wagtail.documents.blocks.DocumentChooserBlock( + help_text=( + "Sélectionnez un document pour rendre la carte" + " cliquable vers celui ci (si le champ `Lien`" + " n'est pas renseigné)." + ), + label="ou Document", + required=False, + ), + ), + ], + label="Carte", + ), + ), + ( + "quote", + wagtail.blocks.StructBlock( + [ + ( + "image", + wagtail.images.blocks.ImageChooserBlock( + label="Illustration (à gauche)", required=False + ), + ), + ("quote", wagtail.blocks.CharBlock(label="Citation")), + ( + "author_name", + wagtail.blocks.CharBlock(label="Nom de l'auteur"), + ), + ( + "author_title", + wagtail.blocks.CharBlock(label="Titre de l'auteur"), + ), + ], + label="Citation", + ), + ), + ( + "text_cta", + wagtail.blocks.StructBlock( + [ + ( + "text", + wagtail.blocks.RichTextBlock( + label="Texte avec mise en forme", required=False + ), + ), + ( + "cta_label", + wagtail.blocks.CharBlock( + help_text=( + "Le lien apparait comme un bouton sous le bloc de" + " texte" + ), + label="Titre de l'appel à l'action", + required=False, + ), + ), + ( + "cta_url", + wagtail.blocks.CharBlock(label="Lien", required=False), + ), + ], + label="Texte et appel à l'action", + ), + ), + ( + "iframe", + wagtail.blocks.StructBlock( + [ + ( + "title", + wagtail.blocks.CharBlock( + help_text=( + "Accessibilité : Le titre doit décrire, de façon" + " claire et concise, le contenu embarqué." + ), + label="Titre", + ), + ), + ( + "url", + wagtail.blocks.URLBlock( + help_text=( + "Exemple pour Tally :" + " https://tally.so/embed/w2jMRa" + ), + label="Lien du cadre intégré", + ), + ), + ( + "height", + wagtail.blocks.IntegerBlock(label="Hauteur en pixels"), + ), + ], + label="Cadre intégré", + ), + ), + ], + label="Multi-colonnes", + ), + ), + ], + label="Multi-colonnes", + ), + ), + ( + "accordions", + wagtail.blocks.StreamBlock( + [ + ("title", wagtail.blocks.CharBlock(label="Titre")), + ( + "accordion", + wagtail.blocks.StructBlock( + [ + ("title", wagtail.blocks.CharBlock(label="Titre")), + ("content", wagtail.blocks.RichTextBlock(label="Contenu")), + ], + label="Accordéon", + max_num=15, + min_num=1, + ), + ), + ], + label="Accordéons", + ), + ), + ( + "stepper", + wagtail.blocks.StructBlock( + [ + ("title", wagtail.blocks.CharBlock(label="Titre")), + ("total", wagtail.blocks.IntegerBlock(label="Nombre d'étape")), + ("current", wagtail.blocks.IntegerBlock(label="Étape en cours")), + ( + "steps", + wagtail.blocks.StreamBlock( + [ + ( + "step", + wagtail.blocks.StructBlock( + [ + ("title", wagtail.blocks.CharBlock(label="Titre de l'étape")), + ("detail", wagtail.blocks.TextBlock(label="Détail")), + ], + label="Étape", + ), + ) + ], + label="Les étapes", + ), + ), + ], + label="Étapes", + ), + ), + ( + "separator", + wagtail.blocks.StructBlock( + [ + ( + "top_margin", + wagtail.blocks.IntegerBlock( + default=3, label="Espacement au dessus", max_value=15, min_value=0 + ), + ), + ( + "bottom_margin", + wagtail.blocks.IntegerBlock( + default=3, label="Espacement en dessous", max_value=15, min_value=0 + ), + ), + ], + label="Séparateur", + ), + ), + ], + blank=True, + use_json_field=True, + ), + ), + ] diff --git a/content_manager/models.py b/content_manager/models.py index b35c6c9f..6102b255 100644 --- a/content_manager/models.py +++ b/content_manager/models.py @@ -143,6 +143,18 @@ class TextAndCTA(blocks.StructBlock): cta_url = blocks.CharBlock(label="Lien", required=False) +class IframeBlock(blocks.StructBlock): + title = blocks.CharBlock( + label="Titre", + help_text="Accessibilité : Le titre doit décrire, de façon claire et concise, le contenu embarqué.", + ) + url = blocks.URLBlock( + label="Lien du cadre intégré", + help_text="Exemple pour Tally : https://tally.so/embed/w2jMRa", + ) + height = blocks.IntegerBlock(label="Hauteur en pixels") + + class MultiColumnsBlock(blocks.StreamBlock): text = blocks.RichTextBlock(label="Texte avec mise en forme") image = ImageBlock(label="Image") @@ -150,6 +162,7 @@ class MultiColumnsBlock(blocks.StreamBlock): card = CardBlock(label="Carte") quote = QuoteBlock(label="Citation") text_cta = TextAndCTA(label="Texte et appel à l'action") + iframe = IframeBlock(label="Cadre intégré") class MultiColumnsWithTitleBlock(blocks.StructBlock): diff --git a/content_manager/templates/content_manager/blocks/multicolumns.html b/content_manager/templates/content_manager/blocks/multicolumns.html index 8ad8e75b..11085a77 100644 --- a/content_manager/templates/content_manager/blocks/multicolumns.html +++ b/content_manager/templates/content_manager/blocks/multicolumns.html @@ -52,6 +52,10 @@

{{ subblock.value.title }}

{% image subblock.value.image original as img %} {% dsfr_quote text=subblock.value.quote author=subblock.value.author_name source=subblock.value.author_title image_url=img.url %} + {% elif subblock.block_type == 'iframe' %} +
+ +
{% endif %} {% endfor %} From da006dc884d60beb826f722f3d953d9893162a26 Mon Sep 17 00:00:00 2001 From: Christian Quest Date: Wed, 3 May 2023 17:17:09 +0200 Subject: [PATCH 07/13] Disable S3 if not set and switch to "medias" directory --- config/settings.py | 28 +++++++++++++--------------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/config/settings.py b/config/settings.py index face102b..af13eb15 100644 --- a/config/settings.py +++ b/config/settings.py @@ -158,23 +158,21 @@ "django.contrib.staticfiles.finders.FileSystemFinder", ] -# S3 uploads +# S3 uploads & MEDIA CONFIGURATION # ------------------------------------------------------------------------------ -AWS_S3_ACCESS_KEY_ID = os.getenv("S3_KEY_ID", "123") -AWS_S3_SECRET_ACCESS_KEY = os.getenv("S3_KEY_SECRET", "secret") -AWS_S3_ENDPOINT_URL = f"{os.getenv('S3_PROTOCOL', 'https')}://{os.getenv('S3_HOST', 'set-var-env.com/')}" -AWS_STORAGE_BUCKET_NAME = os.getenv("S3_BUCKET_NAME", "set-bucket-name") -AWS_S3_STORAGE_BUCKET_REGION = os.getenv("S3_BUCKET_REGION", "fr") - -# MEDIA CONFIGURATION -# ------------------------------------------------------------------------------ - -# See: https://docs.djangoproject.com/en/dev/ref/settings/#media-url -MEDIA_URL = f"https://{AWS_S3_ENDPOINT_URL}/" # noqa - -DEFAULT_FILE_STORAGE = "storages.backends.s3boto3.S3Boto3Storage" - +if os.getenv('S3_HOST'): + AWS_S3_ACCESS_KEY_ID = os.getenv("S3_KEY_ID", "123") + AWS_S3_SECRET_ACCESS_KEY = os.getenv("S3_KEY_SECRET", "secret") + AWS_S3_ENDPOINT_URL = f"{os.getenv('S3_PROTOCOL', 'https')}://{os.getenv('S3_HOST', 'set-var-env.com/')}" + AWS_STORAGE_BUCKET_NAME = os.getenv("S3_BUCKET_NAME", "set-bucket-name") + AWS_S3_STORAGE_BUCKET_REGION = os.getenv("S3_BUCKET_REGION", "fr") + DEFAULT_FILE_STORAGE = "storages.backends.s3boto3.S3Boto3Storage" + MEDIA_URL = f"https://{AWS_S3_ENDPOINT_URL}/" # noqa +else: + DEFAULT_FILE_STORAGE = "django.core.files.storage.FileSystemStorage" + MEDIA_URL = "medias/" + # Django Sass SASS_PROCESSOR_ROOT = os.path.join(BASE_DIR, "static") From bee3bd1b11499d02cf948f28819b62e5ee4a8334 Mon Sep 17 00:00:00 2001 From: Christian Quest Date: Wed, 3 May 2023 17:18:50 +0200 Subject: [PATCH 08/13] Auto-update CSFR allowed origins based on ALLOWED_HOSTS --- config/settings.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/config/settings.py b/config/settings.py index face102b..756e6165 100644 --- a/config/settings.py +++ b/config/settings.py @@ -214,3 +214,7 @@ WAGTAILEMBEDS_RESPONSIVE_HTML = True WAGTAIL_MODERATION_ENABLED = False + +CSRF_TRUSTED_ORIGINS=[] +for host in ALLOWED_HOSTS: + CSRF_TRUSTED_ORIGINS.append('https://'+host) From 77a8e93f742d7e84a7df377bfec6ef6c7acf279c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Reuiller?= Date: Fri, 12 May 2023 10:04:31 +0200 Subject: [PATCH 09/13] better make --- Makefile | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/Makefile b/Makefile index 0fcee0dd..5a3a05ef 100644 --- a/Makefile +++ b/Makefile @@ -1,31 +1,31 @@ -reset-db: - psql -c 'DROP DATABASE djdb;' - psql -c 'ALTER USER dju CREATEDB;' - psql -c 'CREATE DATABASE djdb OWNER dju;' - python manage.py migrate +ifeq ($(USE_VENV),1) + EXEC_CMD := +else + EXEC_CMD := docker-compose exec -ti web +endif .PHONY: web-prompt web-prompt: - docker-compose run --rm web bash + $(EXEC_CMD) bash .PHONY: test-unit test-unit: - python manage.py test --settings config.settings_test + $(EXEC_CMD) python manage.py test --settings config.settings_test .PHONY: test-e2e test-e2e: - python manage.py behave --settings config.settings_test + $(EXEC_CMD) python manage.py behave --settings config.settings_test .PHONY: test test: test-e2e test-unit .PHONY: quality quality: - black --check --exclude=venv . - isort --check --skip-glob="**/migrations" --extend-skip-glob="venv" . - flake8 --count --show-source --statistics --exclude=venv . + $(EXEC_CMD) black --check --exclude=venv . + $(EXEC_CMD) isort --check --skip-glob="**/migrations" --extend-skip-glob="venv" . + $(EXEC_CMD) flake8 --count --show-source --statistics --exclude=venv . .PHONY: fix fix: - black --exclude=venv . - isort --skip-glob="**/migrations" --extend-skip-glob="venv" . + $(EXEC_CMD) black --exclude=venv . + $(EXEC_CMD) isort --skip-glob="**/migrations" --extend-skip-glob="venv" . From 4025afbf39bb6dd379cfb4898b4aaba161e13c5c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Reuiller?= Date: Fri, 12 May 2023 10:06:47 +0200 Subject: [PATCH 10/13] fix quality --- config/settings.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/config/settings.py b/config/settings.py index dd2d9bb7..65c2e743 100644 --- a/config/settings.py +++ b/config/settings.py @@ -161,7 +161,7 @@ # S3 uploads & MEDIA CONFIGURATION # ------------------------------------------------------------------------------ -if os.getenv('S3_HOST'): +if os.getenv("S3_HOST"): AWS_S3_ACCESS_KEY_ID = os.getenv("S3_KEY_ID", "123") AWS_S3_SECRET_ACCESS_KEY = os.getenv("S3_KEY_SECRET", "secret") AWS_S3_ENDPOINT_URL = f"{os.getenv('S3_PROTOCOL', 'https')}://{os.getenv('S3_HOST', 'set-var-env.com/')}" @@ -172,7 +172,7 @@ else: DEFAULT_FILE_STORAGE = "django.core.files.storage.FileSystemStorage" MEDIA_URL = "medias/" - + # Django Sass SASS_PROCESSOR_ROOT = os.path.join(BASE_DIR, "static") @@ -213,6 +213,6 @@ WAGTAILEMBEDS_RESPONSIVE_HTML = True WAGTAIL_MODERATION_ENABLED = False -CSRF_TRUSTED_ORIGINS=[] +CSRF_TRUSTED_ORIGINS = [] for host in ALLOWED_HOSTS: - CSRF_TRUSTED_ORIGINS.append('https://'+host) + CSRF_TRUSTED_ORIGINS.append("https://" + host) From 7551aeb1eac38d93df1555e98e8c4da319746871 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Reuiller?= Date: Fri, 12 May 2023 10:15:33 +0200 Subject: [PATCH 11/13] update dependencies including django --- requirements.txt | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/requirements.txt b/requirements.txt index c1e5216f..a88494ec 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,19 +1,19 @@ dj-static==0.0.6 -Django==4.1.7 -django-dsfr==0.12.0 -black==23.1.0 +Django==4.1.9 +django-dsfr==0.14.0 +black==23.3.0 flake8==6.0.0 -isort==5.11.4 -pre-commit==2.20.0 -dj-database-url==1.2.0 -psycopg2-binary==2.9.5 -python-dotenv==0.21.0 -whitenoise==6.2.0 -djlint==1.19.9 +isort==5.12.0 +pre-commit==3.3.1 +dj-database-url==2.0.0 +psycopg2-binary==2.9.6 +python-dotenv==1.0.0 +whitenoise==6.4.0 +djlint==1.27.2 gunicorn==20.1.0 -django-sass-processor==1.2.1 -libsass==0.21.0 +django-sass-processor==1.2.2 +libsass==0.22.0 wagtail==4.1.1 wagtailmenus==3.1.3 -boto3==1.26.59 +boto3==1.26.133 django-storages==1.13.2 From 399236d8c3b7d34e66bca7c734f2249abc97a245 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cha=C3=AFb=20Martinez?= Date: Fri, 12 May 2023 16:50:27 +0200 Subject: [PATCH 12/13] Update README.md --- README.md | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index b1d61f6f..150ead47 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,24 @@ -# Content Manager +# Gestionnaire de contenu DSFR et Accessible + +**Créez et gérez votre site internet simplement** + +Gestionnaire de contenu (CMS) pour créer un site internet dont le domaine se terminant par .gouv.fr . Pas besoin de compétence technique pour mettre à jours le contenu. + +**Un CMS basé sur la solution open source Wagtail** + +Créez ou modifiez des pages, ajoutez un menu de navigation, des boutons, images, vidéos, contributeurs etc + +**Système de Design de l'État** + +Construisez vos pages à l'aide de composants prêts à l'emploi issus du Système de Design de l'État (DSFR) + +**Accessible et responsive** + +Le contenu des pages générées par le CMS est partiellement conforme selon la norme RGAA 4.1 et responsive + + + + ## Prérequis From 5e4f7a3ccf7032dc6869ac43f9403f42e88d2061 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Reuiller?= Date: Thu, 3 Aug 2023 15:33:31 +0200 Subject: [PATCH 13/13] fix image name --- .../templates/content_manager/blocks/multicolumns.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content_manager/templates/content_manager/blocks/multicolumns.html b/content_manager/templates/content_manager/blocks/multicolumns.html index 11085a77..e154cadb 100644 --- a/content_manager/templates/content_manager/blocks/multicolumns.html +++ b/content_manager/templates/content_manager/blocks/multicolumns.html @@ -40,7 +40,7 @@

{{ subblock.value.title }}

{% elif subblock.block_type == 'card' %}
- {% image subblock.value.bg_image original as img %} + {% image subblock.value.image original as img %} {% if subblock.value.document %} {% dsfr_card title=subblock.value.title description=subblock.value.description link=subblock.value.document.url image_url=img.url %} {% else %}