diff --git a/core/mixins.py b/core/mixins.py index 160e8684..24d54436 100644 --- a/core/mixins.py +++ b/core/mixins.py @@ -225,6 +225,10 @@ def get_visibilite_display_text(self) -> str: case Visibilite.NATIONALE: return "Toutes les structures" + @property + def visibility_display(self) -> str: + return Visibilite.get_masculine_label(self.visibilite) + def save(self, *args, **kwargs): if self.pk: if self.is_visibilite_limitee and self.allowed_structures.count() == 0: diff --git a/core/models.py b/core/models.py index 17cf28e6..a842231e 100644 --- a/core/models.py +++ b/core/models.py @@ -302,3 +302,8 @@ class Visibilite(models.TextChoices): LOCALE = "locale", "Votre structure et l'administration centrale pourront consulter et modifier la fiche" LIMITEE = "limitee", "Les structures de votre choix pourront consulter et modifier la fiche" NATIONALE = "nationale", "La fiche sera visible et modifiable par toutes les structures" + + @classmethod + def get_masculine_label(cls, value): + masculine_labels = {cls.LOCALE: "Local", cls.LIMITEE: "Limité", cls.NATIONALE: "National"} + return masculine_labels.get(value) diff --git a/sv/display.py b/sv/display.py index 71e4b906..c24261b7 100644 --- a/sv/display.py +++ b/sv/display.py @@ -1,4 +1,5 @@ from dataclasses import dataclass + from sv.models import FicheDetection, OrganismeNuisible, FicheZoneDelimitee @@ -27,7 +28,7 @@ def from_fiche_zone(cls, fiche: FicheZoneDelimitee): is_ac_notified=fiche.evenement.is_ac_notified, date_creation=fiche.date_creation.strftime("%d/%m/%Y"), createur=str(fiche.createur), - visibilite=str(fiche.evenement.visibilite), + visibilite=fiche.evenement.visibility_display, **fiche.evenement.get_etat_data_from_fin_de_suivi(fiche.has_fin_de_suivi), communes_list=[], get_absolute_url=fiche.get_absolute_url() + "#tabpanel-zone-panel", @@ -45,7 +46,7 @@ def from_fiche_detection(cls, fiche: FicheDetection): date_creation=fiche.date_creation.strftime("%d/%m/%Y"), createur=str(fiche.createur), **fiche.evenement.get_etat_data_from_fin_de_suivi(fiche.has_fin_de_suivi), - visibilite=str(fiche.evenement.visibilite), + visibilite=fiche.evenement.visibility_display, communes_list=fiche.lieux_list_with_commune, get_absolute_url=fiche.get_absolute_url() + f"?detection={fiche.pk}", numero_evenement=str(fiche.evenement.numero) if fiche.evenement.numero else "non attribué", diff --git a/sv/templates/sv/_evenement_badges.html b/sv/templates/sv/_evenement_badges.html index 9e993859..9a8366c8 100644 --- a/sv/templates/sv/_evenement_badges.html +++ b/sv/templates/sv/_evenement_badges.html @@ -4,6 +4,6 @@ {% if evenement.is_ac_notified %}

Déclaré AC

{% endif %} -

{{ evenement.visibilite }}

+

{{ evenement.visibility_display }}

{{ etat.readable_etat }}