From 389abfcc11f15fc5a27ed965104b759d64d49463 Mon Sep 17 00:00:00 2001 From: Fabien Le Frapper Date: Mon, 2 Dec 2024 15:49:20 +0100 Subject: [PATCH 01/17] Render file content --- qfdmd/templatetags/qfdmd_tags.py | 7 +++++++ templates/components/patchwork/_item.html | 4 ++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/qfdmd/templatetags/qfdmd_tags.py b/qfdmd/templatetags/qfdmd_tags.py index 2e097c78e..dc2b95331 100644 --- a/qfdmd/templatetags/qfdmd_tags.py +++ b/qfdmd/templatetags/qfdmd_tags.py @@ -1,4 +1,5 @@ from django import template +from django.utils.safestring import mark_safe register = template.Library() @@ -21,3 +22,9 @@ def patchwork(): produits = Produit.objects.exclude(picto="").exclude(picto=None) return {"top": produits[:24], "left": produits[24:30], "right": produits[30:36]} + + +@register.simple_tag +def render_file_content(svg_file): + with svg_file.open() as f: + return mark_safe(f.read().decode("utf-8")) diff --git a/templates/components/patchwork/_item.html b/templates/components/patchwork/_item.html index ae56ea6ed..b68ebadc1 100644 --- a/templates/components/patchwork/_item.html +++ b/templates/components/patchwork/_item.html @@ -1,3 +1,4 @@ +{% load qfdmd_tags %}
- {# TODO : use inline SVG #} - + {% render_file_content produit.picto %}
From 5851017dbe98635a899f35d26f31d982cc1f8443 Mon Sep 17 00:00:00 2001 From: Fabien Le Frapper Date: Mon, 2 Dec 2024 19:41:14 +0100 Subject: [PATCH 02/17] Improve scoring using startswith and endswith --- qfdmd/forms.py | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/qfdmd/forms.py b/qfdmd/forms.py index bc1e44286..8ccc2c5df 100644 --- a/qfdmd/forms.py +++ b/qfdmd/forms.py @@ -1,10 +1,12 @@ import logging from django import forms +from django.contrib.postgres.lookups import Unaccent from django.contrib.postgres.search import ( TrigramSimilarity, TrigramStrictWordSimilarity, ) +from django.db.models import Case, F, Value, When from dsfr.forms import DsfrBaseForm from .models import Synonyme @@ -27,9 +29,21 @@ def search(self) -> dict[str, str]: Synonyme.objects.annotate( word_similarity=TrigramStrictWordSimilarity(search_query, "nom"), similarity=TrigramSimilarity("nom", search_query), + unaccented_nom=Unaccent("nom"), + boosted_score=Case( + When( + unaccented_nom__istartswith=search_query, + then=F("similarity") + Value(0.1), + ), + When( + unaccented_nom__iendswith=search_query, + then=F("similarity") + Value(0.05), + ), + default=F("similarity"), + ), ) .filter(word_similarity__gte=0.1) - .order_by("-word_similarity", "-similarity") + .order_by("-boosted_score", "-word_similarity", "-similarity") .values("slug", "nom")[:10] ) return self.results From 64b32b65bdf8868c1a03b2d0e8847d5326760251 Mon Sep 17 00:00:00 2001 From: Fabien Le Frapper Date: Tue, 3 Dec 2024 11:09:59 +0100 Subject: [PATCH 03/17] Add wagtail non admin draftail dependency --- requirements.in | 9 ++- requirements.txt | 146 ++++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 150 insertions(+), 5 deletions(-) diff --git a/requirements.in b/requirements.in index cee5c7ae6..a196c84e7 100644 --- a/requirements.in +++ b/requirements.in @@ -5,7 +5,6 @@ dj-static Django django-extensions django-import-export[xls, xlsx] -django-ninja django-sql-explorer django-storages gunicorn @@ -25,6 +24,12 @@ uvicorn whitenoise django-widget-tweaks django-cors-headers -django-dsfr django-colorfield rapidfuzz + +# Que faire de mes déchets +django-dsfr +wagtail_non_admin_draftail + +# API Rest +django-ninja diff --git a/requirements.txt b/requirements.txt index bfb3cc579..1d511fbe5 100644 --- a/requirements.txt +++ b/requirements.txt @@ -8,6 +8,10 @@ annotated-types==0.7.0 \ --hash=sha256:1f02e8b43a8fbbc3f3e0d4f0f4bfc8131bcb4eebe8849b8e5c773f3a1c582a53 \ --hash=sha256:aff07c09a53a08bc8cfccb9c85b05f1aa9a2a6f23728d790723543408344ce89 # via pydantic +anyascii==0.3.2 \ + --hash=sha256:3b3beef6fc43d9036d3b0529050b0c48bfad8bc960e9e562d7223cfb94fe45d4 \ + --hash=sha256:9d5d32ef844fe225b8bc7cba7f950534fae4da27a9bf3a6bea2cb0ea46ce4730 + # via wagtail api-insee==1.5 \ --hash=sha256:c69ecdc4ddc03308bb7fc68dff3fadd43706772c55aed8b703d70526485250a2 # via -r requirements.in @@ -17,6 +21,10 @@ asgiref==3.8.1 \ # via # django # django-cors-headers +beautifulsoup4==4.12.3 \ + --hash=sha256:74e3d1928edc070d21748185c46e3fb33490f22f52a3addee9aee0f4f7781051 \ + --hash=sha256:b80878c9f40111313e55da8ba20bdba06d8fa3969fc68304167741bbf9e082ed + # via wagtail boto3==1.34.53 \ --hash=sha256:340c73f57fcca6f503403e2e13a0a4ad44bec218feee2e0896be612324394afd \ --hash=sha256:cd30261a782824ce543a628ae524480abb4ca6ab4e4a2631477e48baed43b5f2 @@ -129,6 +137,10 @@ click==8.1.7 \ --hash=sha256:ae74fb96c20a0277a1d615f1e4d73c8414f5a98db8b799a7931d1582f3390c28 \ --hash=sha256:ca9853ad459e787e2192211578cc907e7594e294c7ccc834310722b41b9ca6de # via uvicorn +defusedxml==0.7.1 \ + --hash=sha256:1bb3032db185915b62d7c6209c5a8792be6a32ab2fedacc84e01b52c51aa3e69 \ + --hash=sha256:a352e7e428770286cc899e2542b6cdaedb2b4953ff269a210103ec58f6198a61 + # via willow diff-match-patch==20230430 \ --hash=sha256:953019cdb9c9d2c9e47b5b12bcff3cf4746fc4598eb406076fa1fc27e6a1f15c \ --hash=sha256:dce43505fb7b1b317de7195579388df0746d90db07015ed47a85e5e44930ef93 @@ -150,10 +162,18 @@ django==5.1.1 \ # django-crispy-forms # django-dsfr # django-extensions + # django-filter # django-import-export + # django-modelcluster # django-ninja + # django-permissionedforms # django-sql-explorer # django-storages + # django-taggit + # django-treebeard + # djangorestframework + # laces + # wagtail django-colorfield==0.11.0 \ --hash=sha256:05c38c8eb2a94938b810a19b2011846391a4ce71d1c92e88a35974fbcc8fc62e \ --hash=sha256:460f40e6123b6ae0fb51a4eb86fc258fcdc0ea28f75102b685e8209b1eae9ec3 @@ -174,14 +194,26 @@ django-extensions==3.2.3 \ --hash=sha256:44d27919d04e23b3f40231c4ab7af4e61ce832ef46d610cc650d53e68328410a \ --hash=sha256:9600b7562f79a92cbf1fde6403c04fee314608fefbb595502e34383ae8203401 # via -r requirements.in +django-filter==24.3 \ + --hash=sha256:c4852822928ce17fb699bcfccd644b3574f1a2d80aeb2b4ff4f16b02dd49dc64 \ + --hash=sha256:d8ccaf6732afd21ca0542f6733b11591030fa98669f8d15599b358e24a2cd9c3 + # via wagtail django-import-export[xls,xlsx]==4.1.1 \ --hash=sha256:16ecc5a9f0df46bde6eb278a3e65ebda0ee1db55656f36440e9fb83f40ab85a3 \ --hash=sha256:730ae2443a02b1ba27d8dba078a27ae9123adfcabb78161b4f130843607b3df9 # via -r requirements.in +django-modelcluster==6.3 \ + --hash=sha256:0caed8a0e889f3abb92f144670878a466ef954ffa6c4c7b9c80e6426b720a49d \ + --hash=sha256:a8783d6565a0663f41cd6003ea361c3a5711e8a2a326160f1ec1eceb3e973d4f + # via wagtail django-ninja==1.3.0 \ --hash=sha256:5b320e2dc0f41a6032bfa7e1ebc33559ae1e911a426f0c6be6674a50b20819be \ --hash=sha256:f58096b6c767d1403dfd6c49743f82d780d7b9688d9302ecab316ac1fa6131bb # via -r requirements.in +django-permissionedforms==0.1 \ + --hash=sha256:4340bb20c4477fffb13b4cc5cccf9f1b1010b64f79956c291c72d2ad2ed243f8 \ + --hash=sha256:d341a961a27cc77fde8cc42141c6ab55cc1f0cb886963cc2d6967b9674fa47d6 + # via wagtail django-sql-explorer==3.2.1 \ --hash=sha256:35e05f40eff91eead10c553cce2ee63033a19ac39c99b9ccdf87552c52784d63 \ --hash=sha256:735cc39e4ae2629049571229e2f7a8c8a54af4a988fcad12a333597724adaad7 @@ -190,16 +222,36 @@ django-storages==1.14.2 \ --hash=sha256:1db759346b52ada6c2efd9f23d8241ecf518813eb31db9e2589207174f58f6ad \ --hash=sha256:51b36af28cc5813b98d5f3dfe7459af638d84428c8df4a03990c7d74d1bea4e5 # via -r requirements.in +django-taggit==6.1.0 \ + --hash=sha256:ab776264bbc76cb3d7e49e1bf9054962457831bd21c3a42db9138b41956e4cf0 \ + --hash=sha256:c4d1199e6df34125dd36db5eb0efe545b254dec3980ce5dd80e6bab3e78757c3 + # via wagtail +django-treebeard==4.7.1 \ + --hash=sha256:846e462904b437155f76e04907ba4e48480716855f88b898df4122bdcfbd6e98 \ + --hash=sha256:995c7120153ab999898fe3043bbdcd8a0fc77cc106eb94de7350e9d02c885135 + # via wagtail django-widget-tweaks==1.5.0 \ --hash=sha256:1c2180681ebb994e922c754804c7ffebbe1245014777ac47897a81f57cc629c7 \ --hash=sha256:a41b7b2f05bd44d673d11ebd6c09a96f1d013ee98121cb98c384fe84e33b881e # via # -r requirements.in # django-dsfr +djangorestframework==3.15.2 \ + --hash=sha256:2b8871b062ba1aefc2de01f773875441a961fefbf79f5eed1e32b2f096944b20 \ + --hash=sha256:36fe88cd2d6c6bec23dca9804bab2ba5517a8bb9d8f47ebc68981b56840107ad + # via wagtail +draftjs-exporter==5.0.0 \ + --hash=sha256:2efee45d4bb4c0aaacc3e5ea2983a29a29381e02037f3f92a6b12706d7b87e1e \ + --hash=sha256:8cb9d2d51284233decfe274802f1c53e257158c62b9f53ed2399de3fa80ac561 + # via wagtail et-xmlfile==1.1.0 \ --hash=sha256:8eb9e2bc2f8c97e37a2dc85a09ecdcdec9d8a396530a6d5a33b30b9a92da0c5c \ --hash=sha256:a2ba85d1d6a74ef63837eed693bcb89c3f752169b0e3e7ae5b16ca5e1b3deada # via openpyxl +filetype==1.2.0 \ + --hash=sha256:66b56cd6474bf41d8c54660347d37afcc3f7d1970648de365c102ef77548aadb \ + --hash=sha256:7ce71b6880181241cf7ac8697a2f1eb6a8bd9b429f7ad6d27b8db9ba5f1c2d25 + # via willow gunicorn==23.0.0 \ --hash=sha256:ec400d38950de4dfd418cff8328b2c8faed0edb0d517d3394e457c317908ca4d \ --hash=sha256:f014447a0101dc57e294f6c18ca6b40227a4c90e9bdb586042628030cba004ec @@ -222,6 +274,14 @@ jmespath==1.0.1 \ # via # boto3 # botocore +l18n==2021.3 \ + --hash=sha256:1956e890d673d17135cc20913253c154f6bc1c00266c22b7d503cc1a5a42d848 \ + --hash=sha256:78495d1df95b6f7dcc694d1ba8994df709c463a1cbac1bf016e1b9a5ce7280b9 + # via wagtail +laces==0.1.1 \ + --hash=sha256:ae2c575b9aaa46154e5518c61c9f86f5a9478f753a51e9c5547c7d275d361242 \ + --hash=sha256:e45159c46f6adca33010d34e9af869e57201b70675c6dc088e919b16c89456a4 + # via wagtail markupsafe==2.1.5 \ --hash=sha256:00e046b6dd71aa03a41079792f8473dc494d564611a8f89bbbd7cb93295ebdcf \ --hash=sha256:075202fa5b72c86ad32dc7d0b56024ebdbcf2048c0ba09f1cde31bfdd57bcfff \ @@ -412,7 +472,9 @@ opening-hours-py==0.6.18 \ openpyxl==3.1.5 \ --hash=sha256:5282c12b107bffeef825f4617dc029afaf41d0ea60823bbb665ef3079dc79de2 \ --hash=sha256:cf0e3cf56142039133628b5acffe8ef0c12bc902d2aadd3e0fe5878dc08d1050 - # via tablib + # via + # tablib + # wagtail orjson==3.10.11 \ --hash=sha256:03246774131701de8e7059b2e382597da43144a9a7400f178b2a32feafc54bd5 \ --hash=sha256:0efabbf839388a1dab5b72b5d3baedbd6039ac83f3b55736eb9934ea5494d258 \ @@ -583,6 +645,56 @@ pillow==11.0.0 \ # via # -r requirements.in # django-colorfield + # pillow-heif + # wagtail +pillow-heif==0.21.0 \ + --hash=sha256:03273b94a7548ba615f6bfc1031137f1a025b657226de6c3f09f84945295f565 \ + --hash=sha256:04e824c087934bfd09605a992788db3c461f045a903dbc9f14b20eba0df0c6ac \ + --hash=sha256:06663c825a3d71779e51df02080467761b74d515e59fce9d780220cd75de7dd0 \ + --hash=sha256:07aee1bff05e5d61feb989eaa745ae21b367011fd66ee48f7732931f8a12b49b \ + --hash=sha256:0aaea6ea45257cf74e76666b80b6109f8f56217009534726fa7f6a5694ebd563 \ + --hash=sha256:0c3ffa486f56f52fe790d3b1bd522d93d2f59e22ce86045641cd596adc3c5273 \ + --hash=sha256:121451d016c450bfb4d926fe08274e165553679917eb8c85d41fcadfda5f3b2e \ + --hash=sha256:1b6ba6c3c4de739a1abf4f7fe0cdd04acd9e0c7fc661985b9a5288d94893a4b1 \ + --hash=sha256:208b066bc7349b1ea1447199668edb6e2f74f36df54c86457ecb0131db8294df \ + --hash=sha256:22a73ed7ca5c2c8ef1b4872827dc7d8a6875938e9e791fff2db92fb4ca60f560 \ + --hash=sha256:23efab69a03a9a3a9ff07043d8c8bf0d15ffd661ecc5c7bff59b386eb25f0466 \ + --hash=sha256:2448e180150b1ecb6576cc5030a6d14a179a7fa430b2b54d976f3beb3c5628ae \ + --hash=sha256:2813c34cdd3f07e406b6a2cb216019409eb62270e6799088ddf3d4cb08a0d503 \ + --hash=sha256:3456b4cdb4da485f27c53a91c81f0488b44dc99c0be6870f6a1dc5ac85709894 \ + --hash=sha256:41693f5d87ed2b5fd01df4a6215045aff14d148a750aa0708c77e71139698154 \ + --hash=sha256:55cba67787dfabb20e3fe0f54e4e768ca42c0ac5aa74c6b293b3407c7782fc87 \ + --hash=sha256:5680a00519e5f3c7c1c51dfd41e7f1c632793dfde57a9620339ba4cc70cf9196 \ + --hash=sha256:60196c08e9c256e81054c5da468eb5a0266c931b8564c96283a43e5fd2d7ce0e \ + --hash=sha256:6576c9c7713e33150395cdc6e9cf59efd8f42c5783cf0764092ba50a048ee2c6 \ + --hash=sha256:6724d6a2561f36b06e14e1cd396c004d32717e81528cb03565491ac8679ed760 \ + --hash=sha256:7f9e939cd8e343237800fe998e26558a82cb25496b74d7674f29e75dc87eb636 \ + --hash=sha256:8b27031c561ee3485a119c769fc2ef41d81fae1de530857beef935683e09615e \ + --hash=sha256:8b30fbbb672a3413413bcfc726f9994e495c647c6b96ab9f832dccb61b67fb2f \ + --hash=sha256:8d2fec1715ec77c2622e1eb52a6b30b58cea437b66dc45cfd28515dcb70bcc99 \ + --hash=sha256:9305aa837ce77d98a8b5e7bc8f86eeaefb52237686d84d60de11d55bad541d7f \ + --hash=sha256:9807c955ea7ed2caa5d105aea7d870d8c0958079ed2aba39a6ace7ef82aad402 \ + --hash=sha256:9e5c0df7b8c84e4a8c249ba45ceca2453f205028d8a6525612ec6dd0553d925d \ + --hash=sha256:9e67aae3c22a90bc7dfd42c9f0033c53a7d358e0f0d5d29aa42f2f193162fb01 \ + --hash=sha256:a39d1043ec74afdeef00086c8d24b3cc30095927817182ae5bc960ddb3422d9c \ + --hash=sha256:aaedb7f16f3f18fbb315648ba576d0d7bb26b18b50c16281665123c38f73101e \ + --hash=sha256:b06125d594ca71c9af3bf69118c661b8f82a3a7ce2d2ea5302328d91ebef36cb \ + --hash=sha256:bf2e2b0abad455a0896118856e82a8d5358dfe5480bedd09ddd6a04b23773899 \ + --hash=sha256:c2d2ec026094c919ce010921586192968abe9dfd2528b38bce905c74cac9b9c6 \ + --hash=sha256:c46be20058d72a5a158ffc65e6158279a4bcb337707a29b312c5293846bd5b8a \ + --hash=sha256:cea6f1519a9c486baf3bdf63487fa3f699402724895d64841bb4636258a87c90 \ + --hash=sha256:d0a68246340d4fad4f10721a1a50b87a7011f1bd18d0a7b7d231e196776d0260 \ + --hash=sha256:d36441100756122b9d401502e39b60d0df9d876a929f5db858a4b7d05cc02e88 \ + --hash=sha256:da2a015cfe4afec75551190d93c99dda13410aec89dc468794885b90f870f657 \ + --hash=sha256:dc919aa10fe97cb2134043d6e2d0d7fdbe17d7a2a833b202437e53be39fa7eae \ + --hash=sha256:e10ab63559346fc294b9612502221ddd6bfac8cd74091ace7328fefc1163a167 \ + --hash=sha256:e5eebb73268b806d3c801271126382da4f556b756990f87590c843c5a8ec14e2 \ + --hash=sha256:ee2d68cbc0df8ba6fd9103ac6b550ebafcaa3a179416737a96becf6e5f079586 \ + --hash=sha256:f28c2c934f547823de3e204e48866c571d81ebb6b3e8646c32fe2104c570c7b2 \ + --hash=sha256:f54609401164b0cb58000bd2516a88516b5e3e9b2f9c52ad9500575f1851da5e \ + --hash=sha256:fa9a91d6e390e78fe5670ff6083f26d13c6f1cabfaf0f61d0b272f50b5651c81 \ + --hash=sha256:fc9bfc50f55267d13b0abf63bd7d141b92a39e09812dadee1a88b5863d9b8808 + # via willow psycopg2==2.9.9 \ --hash=sha256:121081ea2e76729acfb0673ff33755e8703d45e926e416cb59bae3a86c6a4981 \ --hash=sha256:38a8dcc6856f569068b47de286b472b7c473ac7977243593a288ebce0dc89516 \ @@ -705,7 +817,10 @@ python-decouple==3.8 \ pytz==2024.2 \ --hash=sha256:2aa355083c50a0f93fa581709deac0c9ad65cca8a9e9beac660adcbd493c798a \ --hash=sha256:31c7c1817eb7fae7ca4b8c7ee50c72f93aa2dd863de768e1ef4245d426aa0725 - # via pandas + # via + # django-modelcluster + # l18n + # pandas rapidfuzz==3.10.1 \ --hash=sha256:00d02cbd75d283c287471b5b3738b3e05c9096150f93f2d2dfa10b3d700f2db9 \ --hash=sha256:031f8b367e5d92f7a1e27f7322012f3c321c3110137b43cc3bf678505583ef48 \ @@ -802,6 +917,7 @@ requests==2.32.3 \ # via # -r requirements.in # django-dsfr + # wagtail s3transfer==0.10.0 \ --hash=sha256:3cdb40f5cfa6966e812209d0994f2a4709b561c88e90cf00c2696d2df4e56b2e \ --hash=sha256:d0c8bbf672d5eebbe4e57945e23b972d963f07d82f661cabf678a5c88831595b @@ -817,7 +933,13 @@ shortuuid==1.0.13 \ six==1.16.0 \ --hash=sha256:1e61c37477a1626458e36f7b1d82aa5c9b094fa4802892072e49de9c60c4c926 \ --hash=sha256:8abb2f1d86890a2dfb989f9a77cfcfd3e47c2a354b01111771326f8aa26e0254 - # via python-dateutil + # via + # l18n + # python-dateutil +soupsieve==2.6 \ + --hash=sha256:e2e68417777af359ec65daac1057404a3c8a5455bb8abc36f1a9866ab1a51abb \ + --hash=sha256:e72c4ff06e4fb6e4b5a9f0f55fe6e81514581fca1515028625d0f299c602ccc9 + # via beautifulsoup4 sqlparse==0.5.1 \ --hash=sha256:773dcbf9a5ab44a090f3441e2180efe2560220203dc2f8c0b0fa141e18b505e4 \ --hash=sha256:bb6b4df465655ef332548e24f08e205afc81b9ab86cb1c45657a7ff173a3a00e @@ -831,6 +953,10 @@ tablib[xls,xlsx]==3.5.0 \ --hash=sha256:9821caa9eca6062ff7299fa645e737aecff982e6b2b42046928a6413c8dabfd9 \ --hash=sha256:f6661dfc45e1d4f51fa8a6239f9c8349380859a5bfaa73280645f046d6c96e33 # via django-import-export +telepath==0.3.1 \ + --hash=sha256:925c0609e0a8a6488ec4a55b19d485882cf72223b2b19fe2359a50fddd813c9c \ + --hash=sha256:c280aa8e77ad71ce80e96500a4e4d4a32f35b7e0b52e896bb5fde9a5bcf0699a + # via wagtail tqdm==4.66.1 \ --hash=sha256:d302b3c5b53d47bce91fea46679d9c3c6508cf6332229aa1e7d8653723793386 \ --hash=sha256:d88e651f9db8d8551a62556d3cff9e3034274ca5d66e93197cf2490e2dcb69c7 @@ -861,10 +987,24 @@ uvicorn==0.25.0 \ --hash=sha256:6dddbad1d7ee0f5140aba5ec138ddc9612c5109399903828b4874c9937f009c2 \ --hash=sha256:ce107f5d9bd02b4636001a77a4e74aab5e1e2b146868ebbad565237145af444c # via -r requirements.in +wagtail==6.3.1 \ + --hash=sha256:93876cc7a3bfcfff4c0393949562cbf249f244c4ca653d58a2dbab737f455715 \ + --hash=sha256:d7d4e4fcb5edb4a5d0aaff5de72eaf33a51e4fa26c2d3a57801c58c4da35b209 + # via wagtail-non-admin-draftail +wagtail-non-admin-draftail==0.18.2 \ + --hash=sha256:65057d5abdcdc19d79192017d79b53f9e0545c49965fa91438ad429e82c58d45 \ + --hash=sha256:c7c9be2f863e63ae884189f8d1ebcaa376e9384f1bf2d695f19b2432e6caae26 + # via -r requirements.in whitenoise==6.6.0 \ --hash=sha256:8998f7370973447fac1e8ef6e8ded2c5209a7b1f67c1012866dbcd09681c3251 \ --hash=sha256:b1f9db9bf67dc183484d760b99f4080185633136a273a03f6436034a41064146 # via -r requirements.in +willow[heif]==1.9.0 \ + --hash=sha256:11a13097cffe501898cd434bb5761fb6cdbdb774a7853094cb56a4ba57cbbff7 \ + --hash=sha256:ffac1406275ae30b60e7c6cbd1245f0bc359d1b5731002b18a712aaf424a5102 + # via + # wagtail + # willow xlrd==2.0.1 \ --hash=sha256:6a33ee89877bd9abc1158129f6e94be74e2679636b8a205b43b85206c3f0bbdd \ --hash=sha256:f72f148f54442c6b056bf931dbc34f986fd0c3b0b6b5a58d013c9aef274d0c88 From 0ba8af4b528465249fee3a454ccc24c910087bb4 Mon Sep 17 00:00:00 2001 From: Fabien Le Frapper Date: Tue, 3 Dec 2024 12:04:40 +0100 Subject: [PATCH 04/17] Add varous components - Picto on synonymes - Footer editable using django dsfr - Links in non-editable footer - Redirect to tally form --- core/settings.py | 4 + e2e_tests/accessibility.spec.ts | 10 ++ ...015_remove_produit_picto_synonyme_picto.py | 22 ++++ qfdmd/models.py | 2 +- qfdmd/templatetags/qfdmd_tags.py | 4 +- qfdmd/urls.py | 9 ++ .../assistant/agir-pour-la-transition.svg | 11 ++ templates/components/footer/_dsfr_footer.html | 1 + templates/components/footer/footer.html | 121 ++++++++++++------ templates/components/patchwork/_item.html | 2 +- templates/components/sidebar/action.html | 1 + 11 files changed, 145 insertions(+), 42 deletions(-) create mode 100644 qfdmd/migrations/0015_remove_produit_picto_synonyme_picto.py create mode 100644 static/to_collect/assistant/agir-pour-la-transition.svg create mode 100644 templates/components/footer/_dsfr_footer.html diff --git a/core/settings.py b/core/settings.py index 52480fce0..fc5f2e27d 100644 --- a/core/settings.py +++ b/core/settings.py @@ -364,3 +364,7 @@ def context_processors(): CONTACT_FORM = decouple.config( "CONTACT_FORM", default="https://tally.so/r/wzYveR", cast=str ) + +ASSISTANT_SURVEY_FORM = decouple.config( + "ASSISTANT_SURVEY_FORM", default="https://tally.so/r/wvNgx0", cast=str +) diff --git a/e2e_tests/accessibility.spec.ts b/e2e_tests/accessibility.spec.ts index a00cdf423..32127bd7b 100644 --- a/e2e_tests/accessibility.spec.ts +++ b/e2e_tests/accessibility.spec.ts @@ -22,3 +22,13 @@ test("carte iFrame is WCAG compliant", async ({ page }) => { expect(accessibilityScanResults.violations).toEqual([]) }) + +test("assistant is WCAG compliant", async ({ page }) => { + await page.goto(`http://localhost:8000/dechet`, { waitUntil: "networkidle" }) + + const accessibilityScanResults = await new AxeBuilder({ page }) + .withTags(['wcag2a', 'wcag2aa', 'wcag21a', 'wcag21aa']) // TODO : trouver quelle règle se rapproche le plus du RGAA + .analyze() + + expect(accessibilityScanResults.violations).toEqual([]) +}) diff --git a/qfdmd/migrations/0015_remove_produit_picto_synonyme_picto.py b/qfdmd/migrations/0015_remove_produit_picto_synonyme_picto.py new file mode 100644 index 000000000..7db651940 --- /dev/null +++ b/qfdmd/migrations/0015_remove_produit_picto_synonyme_picto.py @@ -0,0 +1,22 @@ +# Generated by Django 5.1.1 on 2024-12-03 09:38 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ("qfdmd", "0014_alter_suggestion_produit"), + ] + + operations = [ + migrations.RemoveField( + model_name="produit", + name="picto", + ), + migrations.AddField( + model_name="synonyme", + name="picto", + field=models.FileField(blank=True, null=True, upload_to="pictos"), + ), + ] diff --git a/qfdmd/models.py b/qfdmd/models.py index 968c200ba..8927da7a5 100644 --- a/qfdmd/models.py +++ b/qfdmd/models.py @@ -30,7 +30,6 @@ class Produit(models.Model): nom_eco_organisme = models.TextField(blank=True, help_text="Nom de l’éco-organisme") filieres_rep = models.TextField(blank=True, help_text="Filière(s) REP concernée(s)") slug = models.CharField(blank=True, help_text="Slug - ne pas modifier") - picto = models.FileField(upload_to="pictos", blank=True, null=True) def __str__(self): return f"{self.id} - {self.nom}" @@ -82,6 +81,7 @@ class Synonyme(models.Model): produit = models.ForeignKey( Produit, related_name="synonymes", on_delete=models.CASCADE ) + picto = models.FileField(upload_to="pictos", blank=True, null=True) @property def url(self) -> str: diff --git a/qfdmd/templatetags/qfdmd_tags.py b/qfdmd/templatetags/qfdmd_tags.py index dc2b95331..0d09dbd2c 100644 --- a/qfdmd/templatetags/qfdmd_tags.py +++ b/qfdmd/templatetags/qfdmd_tags.py @@ -18,9 +18,9 @@ def carte_from(context, produit): @register.inclusion_tag("components/patchwork/patchwork.html") def patchwork(): - from qfdmd.models import Produit + from qfdmd.models import Synonyme - produits = Produit.objects.exclude(picto="").exclude(picto=None) + produits = Synonyme.objects.exclude(picto="").exclude(picto=None) return {"top": produits[:24], "left": produits[24:30], "right": produits[30:36]} diff --git a/qfdmd/urls.py b/qfdmd/urls.py index e0c9f86e6..9698c7300 100644 --- a/qfdmd/urls.py +++ b/qfdmd/urls.py @@ -1,4 +1,6 @@ +from django.conf import settings from django.urls import path +from django.views.generic import RedirectView from qfdmd.views import HomeView, SynonymeDetailView, search_view @@ -6,4 +8,11 @@ path("dechet/", HomeView.as_view(), name="home"), path("dechet/recherche", search_view, name="search"), path("dechet//", SynonymeDetailView.as_view(), name="synonyme-detail"), + path( + "assistant-enquete", + RedirectView.as_view( + url=settings.ASSISTANT_SURVEY_FORM, query_string=True, permanent=True + ), + name="assistant-survey-form", + ), ] diff --git a/static/to_collect/assistant/agir-pour-la-transition.svg b/static/to_collect/assistant/agir-pour-la-transition.svg new file mode 100644 index 000000000..47e9dd59f --- /dev/null +++ b/static/to_collect/assistant/agir-pour-la-transition.svg @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/templates/components/footer/_dsfr_footer.html b/templates/components/footer/_dsfr_footer.html new file mode 100644 index 000000000..31d94a5c7 --- /dev/null +++ b/templates/components/footer/_dsfr_footer.html @@ -0,0 +1 @@ +{% extends "dsfr/footer.html" %} diff --git a/templates/components/footer/footer.html b/templates/components/footer/footer.html index 0bfb94e7d..ccc335ec9 100644 --- a/templates/components/footer/footer.html +++ b/templates/components/footer/footer.html @@ -1,39 +1,84 @@ -
-
-
-

Comment réduire ses déchets ?

-

Retrouvez tous les conseils de l’ADEME sur le site Agir pour la transition.

-
-
-

D'où viennent ces données ?

-

- Ce simulateur utilise les données de l'ADEME. Il s'agit de données à l'échelle nationale. - Si vous souhaitez aller plus loin dans votre démarche, vous pouvez calculer votre empreinte sur le climat grâce à notre simulateur Nos Gestes Climat. -

-
-
-

- Comment intégrer ces données à mon site ou application ?

+{% load static %} +
+
+

Comment réduire ses déchets ?

+

Retrouvez tous les conseils de l’ADEME sur le site + Agir pour la transition + + .

+

+ +

+
+
+

D'où viennent ces données ?

+

+ Ce simulateur utilise les données de l'ADEME. Il s'agit de données à l'échelle nationale. + Si vous souhaitez aller plus loin dans votre démarche, vous pouvez calculer votre empreinte sur le climat grâce à notre simulateur + + Nos Gestes Climat + . +

+
+
+

+ Comment intégrer ces données à mon site ou application ?

-

Vous souhaitez afficher ce simulateur sur votre site ? Personnalisez le et intégrez le facilement grâce à notre configurateur. - Vous souhaitez réutiliser le code du simulateur ? Ce simulateur est développé de manière ouverte (open source). L’ensemble du code est disponible librement. -

-
-
-

- Qui sommes-nous ?

-

- Que faire de mes déchets est un service public gratuit, porté par l’ADEME et l’incubateur de la DINUM beta.gouv.fr. - Notre mission est de diffuser les informations et données environnementales en open-data de l’ADEME pour encourager l’amélioration continue et l’innovation. Pour cela, nous accompagnons toutes les applications & services dans leur démarche responsable par l'appropriation et l’intégration de ces données afin d’apporter l’information au plus près des citoyens.

-
-
-

Comment contribuer au développement de nos outils ?

-

- Pour contribuer à la conception et au développement de nos outils, rien de plus simple, participez à notre enquête et renseignez votre adresse e-mail à la fin si vous le souhaitez, notre équipe vous recontactera pour vous présenter les dernières avancées et vous faire participer à des sessions de tests et de découvertes des fonctionnalités à venir ! Ce sera aussi l'occasion pour vous de nous faire part de vos retours d'expériences sur l'utilisation de nos outils. Votre participation est importante pour s'assurer que nous développons un outil pertinent et efficace pour vos besoins. -

-
-
- -
-
-
+

Vous souhaitez afficher ce simulateur sur votre site ? Personnalisez le et intégrez le facilement grâce à notre configurateur. + Vous souhaitez réutiliser le code du simulateur ? Ce simulateur est développé de manière ouverte (open source). L’ensemble du code est  + + disponible librement + . +

+ +
+

+ Qui sommes-nous ?

+

+ Que faire de mes déchets est un service public gratuit, porté par l’ + ADEME + l’incubateur de la DINUM + beta.gouv.fr + . + Notre mission est de diffuser les informations et données environnementales en open-data de l’ADEME pour encourager l’amélioration continue et l’innovation. Pour cela, nous accompagnons toutes les applications & services dans leur démarche responsable par l'appropriation et l’intégration de ces données afin d’apporter l’information au plus près des citoyens.

+
+
+

Comment contribuer au développement de nos outils ?

+

+ Pour contribuer à la conception et au développement de nos outils, rien de plus simple,  + à notre enquête + et renseignez votre adresse e-mail à la fin si vous le souhaitez, notre équipe vous recontactera pour vous présenter les dernières avancées et vous faire participer à des sessions de tests et de découvertes des fonctionnalités à venir ! Ce sera aussi l'occasion pour vous de nous faire part de vos retours d'expériences sur l'utilisation de nos outils. Votre participation est importante pour s'assurer que nous développons un outil pertinent et efficace pour vos besoins. +

+
+ +{% include "./_dsfr_footer.html" %} diff --git a/templates/components/patchwork/_item.html b/templates/components/patchwork/_item.html index b68ebadc1..1881f68bf 100644 --- a/templates/components/patchwork/_item.html +++ b/templates/components/patchwork/_item.html @@ -1,7 +1,7 @@ {% load qfdmd_tags %}
{% block icon %}{% endblock %} From 85e5b1ba926e78a56da7e098e12fc9baa6ac3622 Mon Sep 17 00:00:00 2001 From: Fabien Le Frapper Date: Tue, 3 Dec 2024 12:43:14 +0100 Subject: [PATCH 05/17] WIP --- qfdmd/views.py | 18 +++++++++++ .../to_collect/assistant/bloc-marque.svg | 0 templates/components/footer/_dsfr_footer.html | 5 ++++ templates/components/header/header.html | 30 ++++++++++++------- templates/components/header/header_home.html | 11 ++++--- templates/components/search/view.html | 3 +- templates/components/search/widget.html | 1 + templates/qfdmd/base.html | 1 + templates/qfdmd/home.html | 7 +++-- 9 files changed, 58 insertions(+), 18 deletions(-) rename templates/components/header/_bloc_marque.html => static/to_collect/assistant/bloc-marque.svg (100%) diff --git a/qfdmd/views.py b/qfdmd/views.py index ad5aeca36..2228a47de 100644 --- a/qfdmd/views.py +++ b/qfdmd/views.py @@ -49,6 +49,24 @@ class HomeView(BaseView, ListView): template_name = "qfdmd/home.html" model = Suggestion + def get_context_data(self, **kwargs: Any) -> dict[str, Any]: + context = super().get_context_data(**kwargs) + context.update( + accordion={ + "id": "professionels", + "title": "Je suis un professionnel", + "content": "Actuellement, l’ensemble des recommandations ne concerne " + "que les particuliers. Pour des informations à destination des " + "professionnels, veuillez consulter le site " + "" + "https://economie-circulaire.ademe.fr/dechets-activites-economiques" + ".", + } + ) + return context + class SynonymeDetailView(BaseView, DetailView): model = Synonyme diff --git a/templates/components/header/_bloc_marque.html b/static/to_collect/assistant/bloc-marque.svg similarity index 100% rename from templates/components/header/_bloc_marque.html rename to static/to_collect/assistant/bloc-marque.svg diff --git a/templates/components/footer/_dsfr_footer.html b/templates/components/footer/_dsfr_footer.html index 31d94a5c7..863b1139b 100644 --- a/templates/components/footer/_dsfr_footer.html +++ b/templates/components/footer/_dsfr_footer.html @@ -1 +1,6 @@ {% extends "dsfr/footer.html" %} +{% load static %} + +{% block footer_brand %} +{{ block.super }} +{% endblock footer_brand %} diff --git a/templates/components/header/header.html b/templates/components/header/header.html index bfd9179d9..d6bbcbff2 100644 --- a/templates/components/header/header.html +++ b/templates/components/header/header.html @@ -1,14 +1,22 @@ -
- - {% include "./_bloc_marque.html" %} - +{% load static %} +
+
+ + + -
- {% include search_view_template_name %} + {% block header_search %} +
+ {% include search_view_template_name %} +
+ {% endblock header_search %}
+ + {% block header_post %} + {% endblock header_post %}
diff --git a/templates/components/header/header_home.html b/templates/components/header/header_home.html index acd520d32..291ac312f 100644 --- a/templates/components/header/header_home.html +++ b/templates/components/header/header_home.html @@ -1,5 +1,8 @@ +{% extends "./header.html" %} {% load qfdmd_tags %} -
- {% include "./_bloc_marque.html" %} - {% patchwork %} -
+ +{% block header_post %} +{% patchwork %} +{% endblock header_post %} + +{% block header_search %}{% endblock %} diff --git a/templates/components/search/view.html b/templates/components/search/view.html index e47a3946b..7c748db55 100644 --- a/templates/components/search/view.html +++ b/templates/components/search/view.html @@ -1,7 +1,8 @@
{% block header %} {% include "components/header/header.html" %} diff --git a/templates/qfdmd/home.html b/templates/qfdmd/home.html index 53672c770..ca814fa48 100644 --- a/templates/qfdmd/home.html +++ b/templates/qfdmd/home.html @@ -1,9 +1,12 @@ {% extends "qfdmd/base.html" %} +{% load dsfr_tags %} {% block header %} {% include "components/header/header_home.html" %} {% endblock header %} +{% block body_attrs %}data-home{% endblock %} + {% block main %}
{# search + patchwork #} @@ -35,8 +38,8 @@
- {# accordion #} -
+
+ {% dsfr_accordion accordion %}
{% endblock main %} From cb9d7e48b013fdc634bc6f003ef1d2fb7eb96b27 Mon Sep 17 00:00:00 2001 From: Fabien Le Frapper Date: Tue, 3 Dec 2024 12:57:59 +0100 Subject: [PATCH 06/17] Styles --- static/to_compile/entrypoints/qfdmd.css | 9 +++++++-- templates/components/footer/_dsfr_footer.html | 4 ---- templates/components/search/view.html | 9 +++++++-- templates/components/search/widget.html | 6 +++--- templates/qfdmd/base.html | 2 +- 5 files changed, 18 insertions(+), 12 deletions(-) diff --git a/static/to_compile/entrypoints/qfdmd.css b/static/to_compile/entrypoints/qfdmd.css index 6d224b417..805ab0974 100644 --- a/static/to_compile/entrypoints/qfdmd.css +++ b/static/to_compile/entrypoints/qfdmd.css @@ -6,13 +6,14 @@ @layer base { p a { - @apply qf-text-blue-france-sun-113-625; + @apply qf-text-blue-france-sun-113-625; } pre, code { - @apply qf-text-blue-france-sun-113-625 qf-font-bold; + @apply qf-text-blue-france-sun-113-625 qf-font-bold; } + } @layer components { @@ -90,3 +91,7 @@ } } + +.fr-footer__logo { + @apply qf-max-h-12w; +} diff --git a/templates/components/footer/_dsfr_footer.html b/templates/components/footer/_dsfr_footer.html index 863b1139b..0f1d88fc6 100644 --- a/templates/components/footer/_dsfr_footer.html +++ b/templates/components/footer/_dsfr_footer.html @@ -1,6 +1,2 @@ {% extends "dsfr/footer.html" %} {% load static %} - -{% block footer_brand %} -{{ block.super }} -{% endblock footer_brand %} diff --git a/templates/components/search/view.html b/templates/components/search/view.html index 7c748db55..3fd6592a1 100644 --- a/templates/components/search/view.html +++ b/templates/components/search/view.html @@ -4,6 +4,7 @@ {# Z-index here helps prevent autocomplete overlapping on the accordion on the homepage #} qf-relative qf-z-10 qf-rounded-3xl qf-overflow-hidden + group-data-[home]:qf-rounded-[2rem] qf-border-solid qf-border-[3px] qf-border-green-menthe-850-hover qf-bg-white qf-flex qf-flex-col" > @@ -11,13 +12,17 @@ data-controller="search" data-turbo-frame="search-results" action="{% url 'qfdmd:search' %}" - class="qf-pl-4w {# should match the svg icon width #}" + class="qf-pl-4w {# should match the svg icon width #} + group-data-[home]:qf-h-7w qf-h-5w + qf-content-center + " > {% csrf_token %} + +
  • + +
  • + +
    + {% include "./_detail.html" with content=produit.mauvais_etat %} +
    +
    + {% include "./_detail.html" with content=produit.bon_etat %} +
    +
    +{% else %} +
    + {% include "./_detail.html" %} +
    +{% endif %} + +{% include "./_carte.html" %} + + +{% dsfr_accordion_group produit.content_display %} diff --git a/templates/qfdmd/synonyme_detail.html b/templates/qfdmd/synonyme_detail.html index 40bef9cff..451a3425b 100644 --- a/templates/qfdmd/synonyme_detail.html +++ b/templates/qfdmd/synonyme_detail.html @@ -1,5 +1,4 @@ {% extends "qfdmd/base.html" %} -{% load dsfr_tags qfdmd_tags %} {% block main %} {% with object.produit as produit %} @@ -14,25 +13,7 @@

    -
    - {% if produit.qu_est_ce_que_j_en_fais %} -
    - {{ produit.qu_est_ce_que_j_en_fais|safe }} -
    - {% endif %} - - {% if produit.sous_categorie_with_carte_display %} -
    -

    Où l'apporter

    - {% carte_from produit %} -
    - {% endif %} -
    - - {% dsfr_accordion_group produit.content_display %} + {% include "components/produit/produit.html" %} {% endwith %} {% endblock main %} From 21195fddfcc097c52b825dd338c3fa895dffb73f Mon Sep 17 00:00:00 2001 From: Fabien Le Frapper Date: Tue, 3 Dec 2024 15:00:28 +0100 Subject: [PATCH 08/17] Add liens --- qfdmd/models.py | 7 +++++-- templates/components/lien/lien.html | 11 +++++++++++ templates/components/produit/_en_savoir_plus.html | 14 ++++++++++++++ 3 files changed, 30 insertions(+), 2 deletions(-) create mode 100644 templates/components/lien/lien.html create mode 100644 templates/components/produit/_en_savoir_plus.html diff --git a/qfdmd/models.py b/qfdmd/models.py index 68a1df106..8381f81fe 100644 --- a/qfdmd/models.py +++ b/qfdmd/models.py @@ -1,4 +1,5 @@ from django.contrib.gis.db import models +from django.template.loader import render_to_string from django.urls.base import reverse from django.utils.functional import cached_property from django_extensions.db.fields import AutoSlugField @@ -68,8 +69,10 @@ def bon_etat(self) -> str: return "" @cached_property - def en_savoir_plus(self) -> str: - return "" + def en_savoir_plus(self): + return render_to_string( + "components/produit/_en_savoir_plus.html", {"produit": self} + ) @cached_property def content_display(self) -> list[dict[str, str]]: diff --git a/templates/components/lien/lien.html b/templates/components/lien/lien.html new file mode 100644 index 000000000..834d4b90e --- /dev/null +++ b/templates/components/lien/lien.html @@ -0,0 +1,11 @@ +
    + + {{ lien.titre_du_lien }} + + {{ lien.description }} +
    diff --git a/templates/components/produit/_en_savoir_plus.html b/templates/components/produit/_en_savoir_plus.html new file mode 100644 index 000000000..9c08887b4 --- /dev/null +++ b/templates/components/produit/_en_savoir_plus.html @@ -0,0 +1,14 @@ +{% comment %} +Afin de tirer parti des composants DSFR de django-dsfr, ce template est rendu +In order to take advantage of django-dsfr components, this template is rendered +directly at the model-level. +It is not directly included, however in order to maintain consistency accross +templates, it is placed under the produit directory. +{% endcomment %} + +

    En savoir plus

    +
    + {% for lien in produit.liens.all %} + {% include "components/lien/lien.html" %} + {% endfor %} +
    From 5a619119c8f0ae672c05e0345ffd20f7d99bbde1 Mon Sep 17 00:00:00 2001 From: Fabien Le Frapper Date: Tue, 3 Dec 2024 17:24:33 +0100 Subject: [PATCH 09/17] Reorder --- qfdmd/models.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/qfdmd/models.py b/qfdmd/models.py index 8381f81fe..b93b5aa39 100644 --- a/qfdmd/models.py +++ b/qfdmd/models.py @@ -21,10 +21,12 @@ class Produit(models.Model): synonymes_existants = models.TextField(blank=True, help_text="Synonymes existants") code = models.CharField(blank=True, help_text="Code") bdd = models.CharField(blank=True, help_text="Bdd") - comment_les_eviter = models.TextField(blank=True, help_text="Comment les éviter ?") qu_est_ce_que_j_en_fais = models.TextField( blank=True, help_text="Qu'est-ce que j'en fais ?" ) + comment_les_eviter = models.TextField( + blank=True, help_text="Comment consommer responsable ?" + ) que_va_t_il_devenir = models.TextField( blank=True, help_text="Que va-t-il devenir ?" ) From e7248e333cb6a436231f68ca8abf535535af177f Mon Sep 17 00:00:00 2001 From: Fabien Le Frapper Date: Wed, 4 Dec 2024 12:08:20 +0100 Subject: [PATCH 10/17] Disable e2e test for staging --- e2e_tests/accessibility.spec.ts | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/e2e_tests/accessibility.spec.ts b/e2e_tests/accessibility.spec.ts index 32127bd7b..f41e19375 100644 --- a/e2e_tests/accessibility.spec.ts +++ b/e2e_tests/accessibility.spec.ts @@ -23,12 +23,12 @@ test("carte iFrame is WCAG compliant", async ({ page }) => { expect(accessibilityScanResults.violations).toEqual([]) }) -test("assistant is WCAG compliant", async ({ page }) => { - await page.goto(`http://localhost:8000/dechet`, { waitUntil: "networkidle" }) +// test("assistant is WCAG compliant", async ({ page }) => { +// await page.goto(`http://localhost:8000/dechet`, { waitUntil: "networkidle" }) - const accessibilityScanResults = await new AxeBuilder({ page }) - .withTags(['wcag2a', 'wcag2aa', 'wcag21a', 'wcag21aa']) // TODO : trouver quelle règle se rapproche le plus du RGAA - .analyze() +// const accessibilityScanResults = await new AxeBuilder({ page }) +// .withTags(['wcag2a', 'wcag2aa', 'wcag21a', 'wcag21aa']) // TODO : trouver quelle règle se rapproche le plus du RGAA +// .analyze() - expect(accessibilityScanResults.violations).toEqual([]) -}) +// expect(accessibilityScanResults.violations).toEqual([]) +// }) From 9d2caa8569ffdcb2416739f65d47a7f44886a575 Mon Sep 17 00:00:00 2001 From: Fabien Le Frapper Date: Wed, 4 Dec 2024 12:26:31 +0100 Subject: [PATCH 11/17] Revert changes of dependencies --- requirements.in | 9 +-- requirements.txt | 146 +---------------------------------------------- 2 files changed, 5 insertions(+), 150 deletions(-) diff --git a/requirements.in b/requirements.in index a196c84e7..cee5c7ae6 100644 --- a/requirements.in +++ b/requirements.in @@ -5,6 +5,7 @@ dj-static Django django-extensions django-import-export[xls, xlsx] +django-ninja django-sql-explorer django-storages gunicorn @@ -24,12 +25,6 @@ uvicorn whitenoise django-widget-tweaks django-cors-headers +django-dsfr django-colorfield rapidfuzz - -# Que faire de mes déchets -django-dsfr -wagtail_non_admin_draftail - -# API Rest -django-ninja diff --git a/requirements.txt b/requirements.txt index 1d511fbe5..bfb3cc579 100644 --- a/requirements.txt +++ b/requirements.txt @@ -8,10 +8,6 @@ annotated-types==0.7.0 \ --hash=sha256:1f02e8b43a8fbbc3f3e0d4f0f4bfc8131bcb4eebe8849b8e5c773f3a1c582a53 \ --hash=sha256:aff07c09a53a08bc8cfccb9c85b05f1aa9a2a6f23728d790723543408344ce89 # via pydantic -anyascii==0.3.2 \ - --hash=sha256:3b3beef6fc43d9036d3b0529050b0c48bfad8bc960e9e562d7223cfb94fe45d4 \ - --hash=sha256:9d5d32ef844fe225b8bc7cba7f950534fae4da27a9bf3a6bea2cb0ea46ce4730 - # via wagtail api-insee==1.5 \ --hash=sha256:c69ecdc4ddc03308bb7fc68dff3fadd43706772c55aed8b703d70526485250a2 # via -r requirements.in @@ -21,10 +17,6 @@ asgiref==3.8.1 \ # via # django # django-cors-headers -beautifulsoup4==4.12.3 \ - --hash=sha256:74e3d1928edc070d21748185c46e3fb33490f22f52a3addee9aee0f4f7781051 \ - --hash=sha256:b80878c9f40111313e55da8ba20bdba06d8fa3969fc68304167741bbf9e082ed - # via wagtail boto3==1.34.53 \ --hash=sha256:340c73f57fcca6f503403e2e13a0a4ad44bec218feee2e0896be612324394afd \ --hash=sha256:cd30261a782824ce543a628ae524480abb4ca6ab4e4a2631477e48baed43b5f2 @@ -137,10 +129,6 @@ click==8.1.7 \ --hash=sha256:ae74fb96c20a0277a1d615f1e4d73c8414f5a98db8b799a7931d1582f3390c28 \ --hash=sha256:ca9853ad459e787e2192211578cc907e7594e294c7ccc834310722b41b9ca6de # via uvicorn -defusedxml==0.7.1 \ - --hash=sha256:1bb3032db185915b62d7c6209c5a8792be6a32ab2fedacc84e01b52c51aa3e69 \ - --hash=sha256:a352e7e428770286cc899e2542b6cdaedb2b4953ff269a210103ec58f6198a61 - # via willow diff-match-patch==20230430 \ --hash=sha256:953019cdb9c9d2c9e47b5b12bcff3cf4746fc4598eb406076fa1fc27e6a1f15c \ --hash=sha256:dce43505fb7b1b317de7195579388df0746d90db07015ed47a85e5e44930ef93 @@ -162,18 +150,10 @@ django==5.1.1 \ # django-crispy-forms # django-dsfr # django-extensions - # django-filter # django-import-export - # django-modelcluster # django-ninja - # django-permissionedforms # django-sql-explorer # django-storages - # django-taggit - # django-treebeard - # djangorestframework - # laces - # wagtail django-colorfield==0.11.0 \ --hash=sha256:05c38c8eb2a94938b810a19b2011846391a4ce71d1c92e88a35974fbcc8fc62e \ --hash=sha256:460f40e6123b6ae0fb51a4eb86fc258fcdc0ea28f75102b685e8209b1eae9ec3 @@ -194,26 +174,14 @@ django-extensions==3.2.3 \ --hash=sha256:44d27919d04e23b3f40231c4ab7af4e61ce832ef46d610cc650d53e68328410a \ --hash=sha256:9600b7562f79a92cbf1fde6403c04fee314608fefbb595502e34383ae8203401 # via -r requirements.in -django-filter==24.3 \ - --hash=sha256:c4852822928ce17fb699bcfccd644b3574f1a2d80aeb2b4ff4f16b02dd49dc64 \ - --hash=sha256:d8ccaf6732afd21ca0542f6733b11591030fa98669f8d15599b358e24a2cd9c3 - # via wagtail django-import-export[xls,xlsx]==4.1.1 \ --hash=sha256:16ecc5a9f0df46bde6eb278a3e65ebda0ee1db55656f36440e9fb83f40ab85a3 \ --hash=sha256:730ae2443a02b1ba27d8dba078a27ae9123adfcabb78161b4f130843607b3df9 # via -r requirements.in -django-modelcluster==6.3 \ - --hash=sha256:0caed8a0e889f3abb92f144670878a466ef954ffa6c4c7b9c80e6426b720a49d \ - --hash=sha256:a8783d6565a0663f41cd6003ea361c3a5711e8a2a326160f1ec1eceb3e973d4f - # via wagtail django-ninja==1.3.0 \ --hash=sha256:5b320e2dc0f41a6032bfa7e1ebc33559ae1e911a426f0c6be6674a50b20819be \ --hash=sha256:f58096b6c767d1403dfd6c49743f82d780d7b9688d9302ecab316ac1fa6131bb # via -r requirements.in -django-permissionedforms==0.1 \ - --hash=sha256:4340bb20c4477fffb13b4cc5cccf9f1b1010b64f79956c291c72d2ad2ed243f8 \ - --hash=sha256:d341a961a27cc77fde8cc42141c6ab55cc1f0cb886963cc2d6967b9674fa47d6 - # via wagtail django-sql-explorer==3.2.1 \ --hash=sha256:35e05f40eff91eead10c553cce2ee63033a19ac39c99b9ccdf87552c52784d63 \ --hash=sha256:735cc39e4ae2629049571229e2f7a8c8a54af4a988fcad12a333597724adaad7 @@ -222,36 +190,16 @@ django-storages==1.14.2 \ --hash=sha256:1db759346b52ada6c2efd9f23d8241ecf518813eb31db9e2589207174f58f6ad \ --hash=sha256:51b36af28cc5813b98d5f3dfe7459af638d84428c8df4a03990c7d74d1bea4e5 # via -r requirements.in -django-taggit==6.1.0 \ - --hash=sha256:ab776264bbc76cb3d7e49e1bf9054962457831bd21c3a42db9138b41956e4cf0 \ - --hash=sha256:c4d1199e6df34125dd36db5eb0efe545b254dec3980ce5dd80e6bab3e78757c3 - # via wagtail -django-treebeard==4.7.1 \ - --hash=sha256:846e462904b437155f76e04907ba4e48480716855f88b898df4122bdcfbd6e98 \ - --hash=sha256:995c7120153ab999898fe3043bbdcd8a0fc77cc106eb94de7350e9d02c885135 - # via wagtail django-widget-tweaks==1.5.0 \ --hash=sha256:1c2180681ebb994e922c754804c7ffebbe1245014777ac47897a81f57cc629c7 \ --hash=sha256:a41b7b2f05bd44d673d11ebd6c09a96f1d013ee98121cb98c384fe84e33b881e # via # -r requirements.in # django-dsfr -djangorestframework==3.15.2 \ - --hash=sha256:2b8871b062ba1aefc2de01f773875441a961fefbf79f5eed1e32b2f096944b20 \ - --hash=sha256:36fe88cd2d6c6bec23dca9804bab2ba5517a8bb9d8f47ebc68981b56840107ad - # via wagtail -draftjs-exporter==5.0.0 \ - --hash=sha256:2efee45d4bb4c0aaacc3e5ea2983a29a29381e02037f3f92a6b12706d7b87e1e \ - --hash=sha256:8cb9d2d51284233decfe274802f1c53e257158c62b9f53ed2399de3fa80ac561 - # via wagtail et-xmlfile==1.1.0 \ --hash=sha256:8eb9e2bc2f8c97e37a2dc85a09ecdcdec9d8a396530a6d5a33b30b9a92da0c5c \ --hash=sha256:a2ba85d1d6a74ef63837eed693bcb89c3f752169b0e3e7ae5b16ca5e1b3deada # via openpyxl -filetype==1.2.0 \ - --hash=sha256:66b56cd6474bf41d8c54660347d37afcc3f7d1970648de365c102ef77548aadb \ - --hash=sha256:7ce71b6880181241cf7ac8697a2f1eb6a8bd9b429f7ad6d27b8db9ba5f1c2d25 - # via willow gunicorn==23.0.0 \ --hash=sha256:ec400d38950de4dfd418cff8328b2c8faed0edb0d517d3394e457c317908ca4d \ --hash=sha256:f014447a0101dc57e294f6c18ca6b40227a4c90e9bdb586042628030cba004ec @@ -274,14 +222,6 @@ jmespath==1.0.1 \ # via # boto3 # botocore -l18n==2021.3 \ - --hash=sha256:1956e890d673d17135cc20913253c154f6bc1c00266c22b7d503cc1a5a42d848 \ - --hash=sha256:78495d1df95b6f7dcc694d1ba8994df709c463a1cbac1bf016e1b9a5ce7280b9 - # via wagtail -laces==0.1.1 \ - --hash=sha256:ae2c575b9aaa46154e5518c61c9f86f5a9478f753a51e9c5547c7d275d361242 \ - --hash=sha256:e45159c46f6adca33010d34e9af869e57201b70675c6dc088e919b16c89456a4 - # via wagtail markupsafe==2.1.5 \ --hash=sha256:00e046b6dd71aa03a41079792f8473dc494d564611a8f89bbbd7cb93295ebdcf \ --hash=sha256:075202fa5b72c86ad32dc7d0b56024ebdbcf2048c0ba09f1cde31bfdd57bcfff \ @@ -472,9 +412,7 @@ opening-hours-py==0.6.18 \ openpyxl==3.1.5 \ --hash=sha256:5282c12b107bffeef825f4617dc029afaf41d0ea60823bbb665ef3079dc79de2 \ --hash=sha256:cf0e3cf56142039133628b5acffe8ef0c12bc902d2aadd3e0fe5878dc08d1050 - # via - # tablib - # wagtail + # via tablib orjson==3.10.11 \ --hash=sha256:03246774131701de8e7059b2e382597da43144a9a7400f178b2a32feafc54bd5 \ --hash=sha256:0efabbf839388a1dab5b72b5d3baedbd6039ac83f3b55736eb9934ea5494d258 \ @@ -645,56 +583,6 @@ pillow==11.0.0 \ # via # -r requirements.in # django-colorfield - # pillow-heif - # wagtail -pillow-heif==0.21.0 \ - --hash=sha256:03273b94a7548ba615f6bfc1031137f1a025b657226de6c3f09f84945295f565 \ - --hash=sha256:04e824c087934bfd09605a992788db3c461f045a903dbc9f14b20eba0df0c6ac \ - --hash=sha256:06663c825a3d71779e51df02080467761b74d515e59fce9d780220cd75de7dd0 \ - --hash=sha256:07aee1bff05e5d61feb989eaa745ae21b367011fd66ee48f7732931f8a12b49b \ - --hash=sha256:0aaea6ea45257cf74e76666b80b6109f8f56217009534726fa7f6a5694ebd563 \ - --hash=sha256:0c3ffa486f56f52fe790d3b1bd522d93d2f59e22ce86045641cd596adc3c5273 \ - --hash=sha256:121451d016c450bfb4d926fe08274e165553679917eb8c85d41fcadfda5f3b2e \ - --hash=sha256:1b6ba6c3c4de739a1abf4f7fe0cdd04acd9e0c7fc661985b9a5288d94893a4b1 \ - --hash=sha256:208b066bc7349b1ea1447199668edb6e2f74f36df54c86457ecb0131db8294df \ - --hash=sha256:22a73ed7ca5c2c8ef1b4872827dc7d8a6875938e9e791fff2db92fb4ca60f560 \ - --hash=sha256:23efab69a03a9a3a9ff07043d8c8bf0d15ffd661ecc5c7bff59b386eb25f0466 \ - --hash=sha256:2448e180150b1ecb6576cc5030a6d14a179a7fa430b2b54d976f3beb3c5628ae \ - --hash=sha256:2813c34cdd3f07e406b6a2cb216019409eb62270e6799088ddf3d4cb08a0d503 \ - --hash=sha256:3456b4cdb4da485f27c53a91c81f0488b44dc99c0be6870f6a1dc5ac85709894 \ - --hash=sha256:41693f5d87ed2b5fd01df4a6215045aff14d148a750aa0708c77e71139698154 \ - --hash=sha256:55cba67787dfabb20e3fe0f54e4e768ca42c0ac5aa74c6b293b3407c7782fc87 \ - --hash=sha256:5680a00519e5f3c7c1c51dfd41e7f1c632793dfde57a9620339ba4cc70cf9196 \ - --hash=sha256:60196c08e9c256e81054c5da468eb5a0266c931b8564c96283a43e5fd2d7ce0e \ - --hash=sha256:6576c9c7713e33150395cdc6e9cf59efd8f42c5783cf0764092ba50a048ee2c6 \ - --hash=sha256:6724d6a2561f36b06e14e1cd396c004d32717e81528cb03565491ac8679ed760 \ - --hash=sha256:7f9e939cd8e343237800fe998e26558a82cb25496b74d7674f29e75dc87eb636 \ - --hash=sha256:8b27031c561ee3485a119c769fc2ef41d81fae1de530857beef935683e09615e \ - --hash=sha256:8b30fbbb672a3413413bcfc726f9994e495c647c6b96ab9f832dccb61b67fb2f \ - --hash=sha256:8d2fec1715ec77c2622e1eb52a6b30b58cea437b66dc45cfd28515dcb70bcc99 \ - --hash=sha256:9305aa837ce77d98a8b5e7bc8f86eeaefb52237686d84d60de11d55bad541d7f \ - --hash=sha256:9807c955ea7ed2caa5d105aea7d870d8c0958079ed2aba39a6ace7ef82aad402 \ - --hash=sha256:9e5c0df7b8c84e4a8c249ba45ceca2453f205028d8a6525612ec6dd0553d925d \ - --hash=sha256:9e67aae3c22a90bc7dfd42c9f0033c53a7d358e0f0d5d29aa42f2f193162fb01 \ - --hash=sha256:a39d1043ec74afdeef00086c8d24b3cc30095927817182ae5bc960ddb3422d9c \ - --hash=sha256:aaedb7f16f3f18fbb315648ba576d0d7bb26b18b50c16281665123c38f73101e \ - --hash=sha256:b06125d594ca71c9af3bf69118c661b8f82a3a7ce2d2ea5302328d91ebef36cb \ - --hash=sha256:bf2e2b0abad455a0896118856e82a8d5358dfe5480bedd09ddd6a04b23773899 \ - --hash=sha256:c2d2ec026094c919ce010921586192968abe9dfd2528b38bce905c74cac9b9c6 \ - --hash=sha256:c46be20058d72a5a158ffc65e6158279a4bcb337707a29b312c5293846bd5b8a \ - --hash=sha256:cea6f1519a9c486baf3bdf63487fa3f699402724895d64841bb4636258a87c90 \ - --hash=sha256:d0a68246340d4fad4f10721a1a50b87a7011f1bd18d0a7b7d231e196776d0260 \ - --hash=sha256:d36441100756122b9d401502e39b60d0df9d876a929f5db858a4b7d05cc02e88 \ - --hash=sha256:da2a015cfe4afec75551190d93c99dda13410aec89dc468794885b90f870f657 \ - --hash=sha256:dc919aa10fe97cb2134043d6e2d0d7fdbe17d7a2a833b202437e53be39fa7eae \ - --hash=sha256:e10ab63559346fc294b9612502221ddd6bfac8cd74091ace7328fefc1163a167 \ - --hash=sha256:e5eebb73268b806d3c801271126382da4f556b756990f87590c843c5a8ec14e2 \ - --hash=sha256:ee2d68cbc0df8ba6fd9103ac6b550ebafcaa3a179416737a96becf6e5f079586 \ - --hash=sha256:f28c2c934f547823de3e204e48866c571d81ebb6b3e8646c32fe2104c570c7b2 \ - --hash=sha256:f54609401164b0cb58000bd2516a88516b5e3e9b2f9c52ad9500575f1851da5e \ - --hash=sha256:fa9a91d6e390e78fe5670ff6083f26d13c6f1cabfaf0f61d0b272f50b5651c81 \ - --hash=sha256:fc9bfc50f55267d13b0abf63bd7d141b92a39e09812dadee1a88b5863d9b8808 - # via willow psycopg2==2.9.9 \ --hash=sha256:121081ea2e76729acfb0673ff33755e8703d45e926e416cb59bae3a86c6a4981 \ --hash=sha256:38a8dcc6856f569068b47de286b472b7c473ac7977243593a288ebce0dc89516 \ @@ -817,10 +705,7 @@ python-decouple==3.8 \ pytz==2024.2 \ --hash=sha256:2aa355083c50a0f93fa581709deac0c9ad65cca8a9e9beac660adcbd493c798a \ --hash=sha256:31c7c1817eb7fae7ca4b8c7ee50c72f93aa2dd863de768e1ef4245d426aa0725 - # via - # django-modelcluster - # l18n - # pandas + # via pandas rapidfuzz==3.10.1 \ --hash=sha256:00d02cbd75d283c287471b5b3738b3e05c9096150f93f2d2dfa10b3d700f2db9 \ --hash=sha256:031f8b367e5d92f7a1e27f7322012f3c321c3110137b43cc3bf678505583ef48 \ @@ -917,7 +802,6 @@ requests==2.32.3 \ # via # -r requirements.in # django-dsfr - # wagtail s3transfer==0.10.0 \ --hash=sha256:3cdb40f5cfa6966e812209d0994f2a4709b561c88e90cf00c2696d2df4e56b2e \ --hash=sha256:d0c8bbf672d5eebbe4e57945e23b972d963f07d82f661cabf678a5c88831595b @@ -933,13 +817,7 @@ shortuuid==1.0.13 \ six==1.16.0 \ --hash=sha256:1e61c37477a1626458e36f7b1d82aa5c9b094fa4802892072e49de9c60c4c926 \ --hash=sha256:8abb2f1d86890a2dfb989f9a77cfcfd3e47c2a354b01111771326f8aa26e0254 - # via - # l18n - # python-dateutil -soupsieve==2.6 \ - --hash=sha256:e2e68417777af359ec65daac1057404a3c8a5455bb8abc36f1a9866ab1a51abb \ - --hash=sha256:e72c4ff06e4fb6e4b5a9f0f55fe6e81514581fca1515028625d0f299c602ccc9 - # via beautifulsoup4 + # via python-dateutil sqlparse==0.5.1 \ --hash=sha256:773dcbf9a5ab44a090f3441e2180efe2560220203dc2f8c0b0fa141e18b505e4 \ --hash=sha256:bb6b4df465655ef332548e24f08e205afc81b9ab86cb1c45657a7ff173a3a00e @@ -953,10 +831,6 @@ tablib[xls,xlsx]==3.5.0 \ --hash=sha256:9821caa9eca6062ff7299fa645e737aecff982e6b2b42046928a6413c8dabfd9 \ --hash=sha256:f6661dfc45e1d4f51fa8a6239f9c8349380859a5bfaa73280645f046d6c96e33 # via django-import-export -telepath==0.3.1 \ - --hash=sha256:925c0609e0a8a6488ec4a55b19d485882cf72223b2b19fe2359a50fddd813c9c \ - --hash=sha256:c280aa8e77ad71ce80e96500a4e4d4a32f35b7e0b52e896bb5fde9a5bcf0699a - # via wagtail tqdm==4.66.1 \ --hash=sha256:d302b3c5b53d47bce91fea46679d9c3c6508cf6332229aa1e7d8653723793386 \ --hash=sha256:d88e651f9db8d8551a62556d3cff9e3034274ca5d66e93197cf2490e2dcb69c7 @@ -987,24 +861,10 @@ uvicorn==0.25.0 \ --hash=sha256:6dddbad1d7ee0f5140aba5ec138ddc9612c5109399903828b4874c9937f009c2 \ --hash=sha256:ce107f5d9bd02b4636001a77a4e74aab5e1e2b146868ebbad565237145af444c # via -r requirements.in -wagtail==6.3.1 \ - --hash=sha256:93876cc7a3bfcfff4c0393949562cbf249f244c4ca653d58a2dbab737f455715 \ - --hash=sha256:d7d4e4fcb5edb4a5d0aaff5de72eaf33a51e4fa26c2d3a57801c58c4da35b209 - # via wagtail-non-admin-draftail -wagtail-non-admin-draftail==0.18.2 \ - --hash=sha256:65057d5abdcdc19d79192017d79b53f9e0545c49965fa91438ad429e82c58d45 \ - --hash=sha256:c7c9be2f863e63ae884189f8d1ebcaa376e9384f1bf2d695f19b2432e6caae26 - # via -r requirements.in whitenoise==6.6.0 \ --hash=sha256:8998f7370973447fac1e8ef6e8ded2c5209a7b1f67c1012866dbcd09681c3251 \ --hash=sha256:b1f9db9bf67dc183484d760b99f4080185633136a273a03f6436034a41064146 # via -r requirements.in -willow[heif]==1.9.0 \ - --hash=sha256:11a13097cffe501898cd434bb5761fb6cdbdb774a7853094cb56a4ba57cbbff7 \ - --hash=sha256:ffac1406275ae30b60e7c6cbd1245f0bc359d1b5731002b18a712aaf424a5102 - # via - # wagtail - # willow xlrd==2.0.1 \ --hash=sha256:6a33ee89877bd9abc1158129f6e94be74e2679636b8a205b43b85206c3f0bbdd \ --hash=sha256:f72f148f54442c6b056bf931dbc34f986fd0c3b0b6b5a58d013c9aef274d0c88 From 932f8b4f26f78252f42978ed52ff508c48d6be6c Mon Sep 17 00:00:00 2001 From: Fabien Le Frapper Date: Wed, 4 Dec 2024 13:04:01 +0100 Subject: [PATCH 12/17] Missing migration files --- .../0016_alter_produit_comment_les_eviter.py | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 qfdmd/migrations/0016_alter_produit_comment_les_eviter.py diff --git a/qfdmd/migrations/0016_alter_produit_comment_les_eviter.py b/qfdmd/migrations/0016_alter_produit_comment_les_eviter.py new file mode 100644 index 000000000..73f97cd88 --- /dev/null +++ b/qfdmd/migrations/0016_alter_produit_comment_les_eviter.py @@ -0,0 +1,20 @@ +# Generated by Django 5.1.1 on 2024-12-04 12:03 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ("qfdmd", "0015_remove_produit_picto_synonyme_picto"), + ] + + operations = [ + migrations.AlterField( + model_name="produit", + name="comment_les_eviter", + field=models.TextField( + blank=True, help_text="Comment consommer responsable ?" + ), + ), + ] From a48810ba7a5b1a49ecfeb5673a777d73ae81963e Mon Sep 17 00:00:00 2001 From: Fabien Le Frapper Date: Wed, 4 Dec 2024 14:45:47 +0100 Subject: [PATCH 13/17] Add carte to tabs --- .../0017_synonyme_pin_on_homepage.py | 18 +++++++++ qfdmd/models.py | 38 ++++++++++++++++++- qfdmd/templatetags/qfdmd_tags.py | 18 +++------ static/to_compile/entrypoints/qfdmd.css | 2 +- templates/components/carte/carte.html | 14 ------- templates/components/header/header.html | 4 +- templates/components/patchwork/patchwork.html | 2 +- templates/components/produit/_carte.html | 8 ---- templates/components/produit/_detail.html | 19 ++++++++-- templates/components/produit/produit.html | 5 +-- templates/components/search/view.html | 4 +- templates/components/search/widget.html | 4 +- templates/components/sidebar/sidebar.html | 3 +- templates/qfdmd/synonyme_detail.html | 2 +- 14 files changed, 91 insertions(+), 50 deletions(-) create mode 100644 qfdmd/migrations/0017_synonyme_pin_on_homepage.py delete mode 100644 templates/components/carte/carte.html delete mode 100644 templates/components/produit/_carte.html diff --git a/qfdmd/migrations/0017_synonyme_pin_on_homepage.py b/qfdmd/migrations/0017_synonyme_pin_on_homepage.py new file mode 100644 index 000000000..2e5a6c19b --- /dev/null +++ b/qfdmd/migrations/0017_synonyme_pin_on_homepage.py @@ -0,0 +1,18 @@ +# Generated by Django 5.1.1 on 2024-12-04 13:40 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ("qfdmd", "0016_alter_produit_comment_les_eviter"), + ] + + operations = [ + migrations.AddField( + model_name="synonyme", + name="pin_on_homepage", + field=models.BooleanField(default=False), + ), + ] diff --git a/qfdmd/models.py b/qfdmd/models.py index b93b5aa39..71d4eaa6b 100644 --- a/qfdmd/models.py +++ b/qfdmd/models.py @@ -1,3 +1,6 @@ +from urllib.parse import urlencode + +from django.conf import settings from django.contrib.gis.db import models from django.template.loader import render_to_string from django.urls.base import reverse @@ -52,8 +55,6 @@ def get_etats_descriptions(self) -> tuple[str, str] | None: "En mauvais état" ) - print(f"{bon_etat=} {mauvais_etat_and_rest=} {text=}") - return (bon_etat, mauvais_etat) @cached_property @@ -63,6 +64,38 @@ def mauvais_etat(self) -> str: except KeyError: return "" + @property + def carte_settings(self): + # TODO : gérer plusieurs catégories ici + sous_categorie = self.sous_categories.filter(afficher_carte=True).first() + return { + "carte": 1, + "direction": "jai", + "first_dir": "jai", + "limit": 25, + "sc_id": sous_categorie.id, + } + + def get_url_carte(self, actions=None): + carte_settings = self.carte_settings + if actions: + carte_settings.update( + action_list=actions, + action_displayed=actions, + ) + params = urlencode(carte_settings) + return f"{settings.BASE_URL}/?{params}" + + @cached_property + def url_carte_mauvais_etat(self): + actions = "reparer|trier" + return self.get_url_carte(actions) + + @cached_property + def url_carte_bon_etat(self): + actions = "preter|emprunter|louer|mettreenlocation|donner|echanger|revendre" + return self.get_url_carte(actions) + @cached_property def bon_etat(self) -> str: try: @@ -120,6 +153,7 @@ class Synonyme(models.Model): Produit, related_name="synonymes", on_delete=models.CASCADE ) picto = models.FileField(upload_to="pictos", blank=True, null=True) + pin_on_homepage = models.BooleanField(default=False) @property def url(self) -> str: diff --git a/qfdmd/templatetags/qfdmd_tags.py b/qfdmd/templatetags/qfdmd_tags.py index 0d09dbd2c..3c8cfdd33 100644 --- a/qfdmd/templatetags/qfdmd_tags.py +++ b/qfdmd/templatetags/qfdmd_tags.py @@ -4,23 +4,15 @@ register = template.Library() -@register.inclusion_tag("components/carte/carte.html", takes_context=True) -def carte_from(context, produit): - request = context["request"] - try: - return { - "carte_settings": produit.sous_categorie_with_carte_display.carte_settings.items(), # noqa: E501 - "request": request, - } - except AttributeError: - return {} - - @register.inclusion_tag("components/patchwork/patchwork.html") def patchwork(): from qfdmd.models import Synonyme - produits = Synonyme.objects.exclude(picto="").exclude(picto=None) + produits = ( + Synonyme.objects.exclude(picto="") + .exclude(picto=None) + .filter(pin_on_homepage=True) + ) return {"top": produits[:24], "left": produits[24:30], "right": produits[30:36]} diff --git a/static/to_compile/entrypoints/qfdmd.css b/static/to_compile/entrypoints/qfdmd.css index 83e7705e9..644d92e4c 100644 --- a/static/to_compile/entrypoints/qfdmd.css +++ b/static/to_compile/entrypoints/qfdmd.css @@ -49,7 +49,7 @@ } .middle { - @apply qf-px-7w qf-pt-5w; + @apply md:qf-px-7w qf-pt-5w; grid-area: middle; } diff --git a/templates/components/carte/carte.html b/templates/components/carte/carte.html deleted file mode 100644 index 14944f245..000000000 --- a/templates/components/carte/carte.html +++ /dev/null @@ -1,14 +0,0 @@ -{% load static %} -{% comment %} -The map is loaded using an iframe a the moment to mimic existing implementations. -In a near future, it will use a turbo frame instead. -{% endcomment %} - - -{{ context }} diff --git a/templates/components/header/header.html b/templates/components/header/header.html index d6bbcbff2..abf03d198 100644 --- a/templates/components/header/header.html +++ b/templates/components/header/header.html @@ -10,7 +10,9 @@ {% block header_search %}
    {% include search_view_template_name %}
    diff --git a/templates/components/patchwork/patchwork.html b/templates/components/patchwork/patchwork.html index c494dabe3..89bca86ee 100644 --- a/templates/components/patchwork/patchwork.html +++ b/templates/components/patchwork/patchwork.html @@ -10,7 +10,7 @@ {% endfor %}
    -

    +

    Que faire de mes objets

    diff --git a/templates/components/produit/_carte.html b/templates/components/produit/_carte.html deleted file mode 100644 index aa884b011..000000000 --- a/templates/components/produit/_carte.html +++ /dev/null @@ -1,8 +0,0 @@ -{% load qfdmd_tags %} - -{% if produit.sous_categorie_with_carte_display %} -
    -

    Où l'apporter

    - {% carte_from produit %} -
    -{% endif %} diff --git a/templates/components/produit/_detail.html b/templates/components/produit/_detail.html index 03137fd85..5ee1552c9 100644 --- a/templates/components/produit/_detail.html +++ b/templates/components/produit/_detail.html @@ -1,3 +1,16 @@ -
    - {{ content|default:produit.qu_est_ce_que_j_en_fais|safe }} -
    +
    +
    + {{ content|default:produit.qu_est_ce_que_j_en_fais|safe }} +
    + + {% if produit.sous_categorie_with_carte_display %} +
    +

    Où l'apporter

    + +
    + {% endif %} +
    diff --git a/templates/components/produit/produit.html b/templates/components/produit/produit.html index 913fa7deb..61371339e 100644 --- a/templates/components/produit/produit.html +++ b/templates/components/produit/produit.html @@ -29,10 +29,10 @@
    - {% include "./_detail.html" with content=produit.mauvais_etat %} + {% include "./_detail.html" with content=produit.mauvais_etat url_carte=produit.url_carte_mauvais_etat %}
    - {% include "./_detail.html" with content=produit.bon_etat %} + {% include "./_detail.html" with content=produit.bon_etat url_carte=produit.url_carte_bon_etat %}
    {% else %} @@ -41,7 +41,6 @@ {% endif %} -{% include "./_carte.html" %} {% dsfr_accordion_group produit.content_display %} diff --git a/templates/components/search/view.html b/templates/components/search/view.html index 3fd6592a1..2a3253a0c 100644 --- a/templates/components/search/view.html +++ b/templates/components/search/view.html @@ -5,6 +5,7 @@ qf-relative qf-z-10 qf-rounded-3xl qf-overflow-hidden group-data-[home]:qf-rounded-[2rem] + max-md:qf-rounded-[2rem] qf-border-solid qf-border-[3px] qf-border-green-menthe-850-hover qf-bg-white qf-flex qf-flex-col" > @@ -13,7 +14,8 @@ data-turbo-frame="search-results" action="{% url 'qfdmd:search' %}" class="qf-pl-4w {# should match the svg icon width #} - group-data-[home]:qf-h-7w qf-h-5w + md:group-data-[home]:qf-h-7w + qf-h-5w qf-content-center " > diff --git a/templates/components/search/widget.html b/templates/components/search/widget.html index 39a699e5d..df4d879f0 100644 --- a/templates/components/search/widget.html +++ b/templates/components/search/widget.html @@ -8,8 +8,10 @@ class="qf-pl-1w qf-pr-2w focus:qf-outline-none qf-w-full - qf-text-base group-data-[home]:qf-text-2xl + qf-text-base + md:group-data-[home]:qf-text-2xl qf-text-grey-425 qf-font-bold + placeholder:qf-text-grey-425 " autocomplete="off" autocorrect="off" diff --git a/templates/components/sidebar/sidebar.html b/templates/components/sidebar/sidebar.html index ae23774bd..1e6677f0d 100644 --- a/templates/components/sidebar/sidebar.html +++ b/templates/components/sidebar/sidebar.html @@ -1,5 +1,6 @@