From 6a2aa3cb83342a927c51e0e2bcbf8653becf7bef Mon Sep 17 00:00:00 2001 From: vincent porte Date: Thu, 29 Feb 2024 17:40:25 +0100 Subject: [PATCH] (surveys) suggest dora searches on cats --- lacommunaute/surveys/admin.py | 2 +- lacommunaute/surveys/apps.py | 1 + .../migrations/0004_recommendation_dora_cats.py | 17 +++++++++++++++++ .../0005_alter_recommendation_dora_cats.py | 17 +++++++++++++++++ lacommunaute/surveys/models.py | 1 + lacommunaute/surveys/recommendations.toml | 8 ++++++++ lacommunaute/templates/surveys/dsp_detail.html | 14 +++++++++++++- 7 files changed, 58 insertions(+), 2 deletions(-) create mode 100644 lacommunaute/surveys/migrations/0004_recommendation_dora_cats.py create mode 100644 lacommunaute/surveys/migrations/0005_alter_recommendation_dora_cats.py diff --git a/lacommunaute/surveys/admin.py b/lacommunaute/surveys/admin.py index fbae01a0d..07de6f50f 100644 --- a/lacommunaute/surveys/admin.py +++ b/lacommunaute/surveys/admin.py @@ -11,4 +11,4 @@ class DSPAdmin(admin.ModelAdmin): @admin.register(Recommendation) class RecommendationAdmin(admin.ModelAdmin): - list_display = ("category", "text") + list_display = ("category", "text", "dora_cats") diff --git a/lacommunaute/surveys/apps.py b/lacommunaute/surveys/apps.py index 8dfbb73fe..529bbb89e 100644 --- a/lacommunaute/surveys/apps.py +++ b/lacommunaute/surveys/apps.py @@ -32,6 +32,7 @@ def create_recommendations(*args, **kwargs): codename=codename, category=spec["category"], text=spec["text"], + dora_cats=spec.get("dora_cats"), ) ) Recommendation.objects.bulk_create(recommendations, ignore_conflicts=True) diff --git a/lacommunaute/surveys/migrations/0004_recommendation_dora_cats.py b/lacommunaute/surveys/migrations/0004_recommendation_dora_cats.py new file mode 100644 index 000000000..bfa82225e --- /dev/null +++ b/lacommunaute/surveys/migrations/0004_recommendation_dora_cats.py @@ -0,0 +1,17 @@ +# Generated by Django 5.0.2 on 2024-02-29 16:17 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + dependencies = [ + ("surveys", "0003_dsp_city_code_dsp_latitude_dsp_location_and_more"), + ] + + operations = [ + migrations.AddField( + model_name="recommendation", + name="dora_cats", + field=models.CharField(blank=True, editable=False, max_length=100, null=True), + ), + ] diff --git a/lacommunaute/surveys/migrations/0005_alter_recommendation_dora_cats.py b/lacommunaute/surveys/migrations/0005_alter_recommendation_dora_cats.py new file mode 100644 index 000000000..30620808c --- /dev/null +++ b/lacommunaute/surveys/migrations/0005_alter_recommendation_dora_cats.py @@ -0,0 +1,17 @@ +# Generated by Django 5.0.2 on 2024-02-29 16:27 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + dependencies = [ + ("surveys", "0004_recommendation_dora_cats"), + ] + + operations = [ + migrations.AlterField( + model_name="recommendation", + name="dora_cats", + field=models.CharField(blank=True, max_length=100, null=True), + ), + ] diff --git a/lacommunaute/surveys/models.py b/lacommunaute/surveys/models.py index 58a372474..f9105613f 100644 --- a/lacommunaute/surveys/models.py +++ b/lacommunaute/surveys/models.py @@ -9,6 +9,7 @@ class Recommendation(models.Model): codename = models.CharField(editable=False, max_length=100, unique=True) category = models.CharField(editable=False, max_length=100) text = models.TextField() + dora_cats = models.CharField(max_length=100, null=True, blank=True) def __str__(self): return f"[{self.category}] {self.text}" diff --git a/lacommunaute/surveys/recommendations.toml b/lacommunaute/surveys/recommendations.toml index a4f669af0..44b97beb3 100644 --- a/lacommunaute/surveys/recommendations.toml +++ b/lacommunaute/surveys/recommendations.toml @@ -85,11 +85,13 @@ text = "Vérifier la continuité des droits et assurer un suivi administratif" codename = "mobilite-0" category = "Mobilité" text = "Mise en place d'un accompagnement pour apprendre à utiliser les transports en commun ou d’une formation à la conduite" +dora_cats = "mobilite" [[recommendations]] codename = "mobilite-1" category = "Mobilité" text = "Aide pour la mise en règle des documents du véhicule et sensibilisation à l'importance de l'assurance et du contrôle technique" +dora_cats = "mobilite" [[recommendations]] codename = "mobilite-2" @@ -98,21 +100,25 @@ text = """ Évaluer les besoins de mobilité spécifiques liés à la garde des enfants et \ au travail possibilité de mise en place de mobilité solidaire\ """ +dora_cats = "mobilite" [[recommendations]] codename = "mobilite-3" category = "Mobilité" text = "Encourager l’usage du covoiturage, valoriser la mobilité dans la recherche d’emploi" +dora_cats = "mobilite" [[recommendations]] codename = "ressources-0" category = "Situation financière" text = "Evaluer et lister le niveau d’endettement" +dora_cats = "gestion-financiere" [[recommendations]] codename = "ressources-1" category = "Situation financière" text = "Suivi du dossier de surendettement et accompagnement vers une gestion budgétaire saine" +dora_cats = "gestion-financiere" [[recommendations]] codename = "ressources-2" @@ -121,11 +127,13 @@ text = """ Accompagnement en gestion budgétaire, orientation vers des aides financières et \ des conseils en économie sociale et familiale\ """ +dora_cats = "gestion-financiere" [[recommendations]] codename = "ressources-3" category = "Situation financière" text = "Ateliers de gestion budgétaire avancée si nécessaire" +dora_cats = "gestion-financiere" [[recommendations]] codename = "judiciaire-0" diff --git a/lacommunaute/templates/surveys/dsp_detail.html b/lacommunaute/templates/surveys/dsp_detail.html index 3190f8915..1d402a404 100644 --- a/lacommunaute/templates/surveys/dsp_detail.html +++ b/lacommunaute/templates/surveys/dsp_detail.html @@ -35,7 +35,19 @@

Général

{{ category }}

{% if not forloop.last %}
{% endif %}