From 5549d2172c41383564e6b23561819c8d1e7d55b1 Mon Sep 17 00:00:00 2001 From: Jean-Marie Favreau Date: Thu, 28 Nov 2024 00:33:41 +0100 Subject: [PATCH] =?UTF-8?q?Un=20utilisateur=20peut=20signaler=20un=20?= =?UTF-8?q?=C3=A9v=C3=A9nement?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fix #15 --- src/agenda_culturel/forms.py | 14 +- .../locale/fr/LC_MESSAGES/django.po | 379 +++++++++--------- .../0121_contactmessage_related_event.py | 19 + src/agenda_culturel/models.py | 13 + .../contactmessage_create_form.html | 25 +- .../contactmessage_moderation_form.html | 7 +- .../agenda_culturel/contactmessages.html | 2 + .../templates/agenda_culturel/page-event.html | 3 +- .../single-event/event-single-inc.html | 9 + src/agenda_culturel/urls.py | 1 + src/agenda_culturel/views.py | 20 +- 11 files changed, 295 insertions(+), 197 deletions(-) create mode 100644 src/agenda_culturel/migrations/0121_contactmessage_related_event.py diff --git a/src/agenda_culturel/forms.py b/src/agenda_culturel/forms.py index 374267d..3cb16c9 100644 --- a/src/agenda_culturel/forms.py +++ b/src/agenda_culturel/forms.py @@ -22,7 +22,8 @@ from .models import ( CategorisationRule, Place, Category, - Tag + Tag, + ContactMessage ) from django.conf import settings from django.core.files import File @@ -736,3 +737,14 @@ class PlaceForm(ModelForm): def apply(self): return self.cleaned_data.get("apply_to_all") + +class ContactMessageForm(ModelForm): + + class Meta: + model = ContactMessage + fields = ["subject", "name", "email", "message", "related_event"] + widgets = {"related_event": HiddenInput()} + + def __init__(self, *args, **kwargs): + self.event = kwargs.pop("event", False) + super().__init__(*args, **kwargs) diff --git a/src/agenda_culturel/locale/fr/LC_MESSAGES/django.po b/src/agenda_culturel/locale/fr/LC_MESSAGES/django.po index 1169a1d..20cb064 100644 --- a/src/agenda_culturel/locale/fr/LC_MESSAGES/django.po +++ b/src/agenda_culturel/locale/fr/LC_MESSAGES/django.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: agenda_culturel\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-11-27 22:42+0100\n" +"POT-Creation-Date: 2024-11-28 00:09+0100\n" "PO-Revision-Date: 2023-10-29 14:16+0000\n" "Last-Translator: Jean-Marie Favreau \n" "Language-Team: Jean-Marie Favreau \n" @@ -110,7 +110,7 @@ msgstr "Non" msgid "Imported from" msgstr "Importé depuis" -#: agenda_culturel/filters.py:362 agenda_culturel/models.py:1718 +#: agenda_culturel/filters.py:362 agenda_culturel/models.py:1728 msgid "Closed" msgstr "Fermé" @@ -118,7 +118,7 @@ msgstr "Fermé" msgid "Open" msgstr "Ouvert" -#: agenda_culturel/filters.py:367 agenda_culturel/models.py:1712 +#: agenda_culturel/filters.py:367 agenda_culturel/models.py:1722 msgid "Spam" msgstr "Spam" @@ -130,79 +130,79 @@ msgstr "Non spam" msgid "Search" msgstr "Rechercher" -#: agenda_culturel/forms.py:106 +#: agenda_culturel/forms.py:107 msgid "Name of new tag" msgstr "Nom de la nouvelle étiquette" -#: agenda_culturel/forms.py:111 +#: agenda_culturel/forms.py:112 msgid "" "Force renaming despite the existence of events already using the chosen tag." msgstr "" "Forcer le renommage malgré l'existence d'événements utilisant déjà " "l'étiquette choisie." -#: agenda_culturel/forms.py:132 agenda_culturel/models.py:175 -#: agenda_culturel/models.py:574 agenda_culturel/models.py:1833 -#: agenda_culturel/models.py:1938 +#: agenda_culturel/forms.py:133 agenda_culturel/models.py:175 +#: agenda_culturel/models.py:574 agenda_culturel/models.py:1843 +#: agenda_culturel/models.py:1948 msgid "Category" msgstr "Catégorie" -#: agenda_culturel/forms.py:138 agenda_culturel/forms.py:163 -#: agenda_culturel/forms.py:193 agenda_culturel/forms.py:337 +#: agenda_culturel/forms.py:139 agenda_culturel/forms.py:164 +#: agenda_culturel/forms.py:194 agenda_culturel/forms.py:338 #: agenda_culturel/models.py:216 agenda_culturel/models.py:682 msgid "Tags" msgstr "Étiquettes" -#: agenda_culturel/forms.py:245 +#: agenda_culturel/forms.py:246 msgid "Main fields" msgstr "Champs principaux" -#: agenda_culturel/forms.py:248 +#: agenda_culturel/forms.py:249 msgid "Start of event" msgstr "Début de l'événement" -#: agenda_culturel/forms.py:252 +#: agenda_culturel/forms.py:253 msgid "End of event" msgstr "Fin de l'événement" -#: agenda_culturel/forms.py:256 +#: agenda_culturel/forms.py:257 msgid "This is a recurring event" msgstr "Cet événement est récurrent" -#: agenda_culturel/forms.py:259 +#: agenda_culturel/forms.py:260 msgid "Details" msgstr "Détails" -#: agenda_culturel/forms.py:264 agenda_culturel/models.py:604 -#: agenda_culturel/models.py:1814 +#: agenda_culturel/forms.py:265 agenda_culturel/models.py:604 +#: agenda_culturel/models.py:1824 msgid "Location" msgstr "Localisation" -#: agenda_culturel/forms.py:268 agenda_culturel/models.py:637 +#: agenda_culturel/forms.py:269 agenda_culturel/models.py:637 msgid "Illustration" msgstr "Illustration" -#: agenda_culturel/forms.py:274 agenda_culturel/forms.py:279 +#: agenda_culturel/forms.py:275 agenda_culturel/forms.py:280 msgid "Meta information" msgstr "Méta-informations" -#: agenda_culturel/forms.py:294 +#: agenda_culturel/forms.py:295 msgid "The end date must be after the start date." msgstr "La date de fin doit être après la date de début." -#: agenda_culturel/forms.py:310 +#: agenda_culturel/forms.py:311 msgid "The end time cannot be earlier than the start time." msgstr "L'heure de fin ne peut pas être avant l'heure de début." -#: agenda_culturel/forms.py:338 +#: agenda_culturel/forms.py:339 msgid "Select tags from existing ones." msgstr "Sélectionner des étiquettes depuis celles existantes." -#: agenda_culturel/forms.py:343 +#: agenda_culturel/forms.py:344 msgid "New tags" msgstr "Nouvelles étiquettes" -#: agenda_culturel/forms.py:344 +#: agenda_culturel/forms.py:345 msgid "" "Create new labels (sparingly). Note: by starting your tag with the " "characters “TW:”, youll create a “trigger warning” tag, and the associated " @@ -213,74 +213,74 @@ msgstr "" "étiquette “trigger warning”, et les événements associés seront annoncés " "comme tels." -#: agenda_culturel/forms.py:387 +#: agenda_culturel/forms.py:388 msgid "JSON in the format expected for the import." msgstr "JSON dans le format attendu pour l'import" -#: agenda_culturel/forms.py:409 +#: agenda_culturel/forms.py:410 msgid " (locally modified version)" msgstr " (version modifiée localement)" -#: agenda_culturel/forms.py:413 +#: agenda_culturel/forms.py:414 msgid " (synchronized on import version)" msgstr " (version synchronisée sur l'import)" -#: agenda_culturel/forms.py:417 +#: agenda_culturel/forms.py:418 msgid "Select {} as representative version." msgstr "Sélectionner {} comme version représentative" -#: agenda_culturel/forms.py:426 +#: agenda_culturel/forms.py:427 msgid "Update {} using some fields from other versions (interactive mode)." msgstr "" "Mettre à jour {} en utilisant quelques champs des autres versions (mode " "interactif)." -#: agenda_culturel/forms.py:433 +#: agenda_culturel/forms.py:434 msgid " Warning: a version is already locally modified." msgstr " Attention: une version a déjà été modifiée localement." -#: agenda_culturel/forms.py:438 +#: agenda_culturel/forms.py:439 msgid "Create a new version by merging (interactive mode)." msgstr "Créer une nouvelle version par fusion (mode interactif)." -#: agenda_culturel/forms.py:445 +#: agenda_culturel/forms.py:446 msgid "Make {} independent." msgstr "Rendre {} indépendant." -#: agenda_culturel/forms.py:447 +#: agenda_culturel/forms.py:448 msgid "Make all versions independent." msgstr "Rendre toutes les versions indépendantes." -#: agenda_culturel/forms.py:481 agenda_culturel/models.py:762 +#: agenda_culturel/forms.py:482 agenda_culturel/models.py:762 msgid "Event" msgstr "Événement" -#: agenda_culturel/forms.py:506 +#: agenda_culturel/forms.py:507 msgid "Value of the selected version" msgstr "Valeur de la version sélectionnée" -#: agenda_culturel/forms.py:508 agenda_culturel/forms.py:512 +#: agenda_culturel/forms.py:509 agenda_culturel/forms.py:513 msgid "Value of version {}" msgstr "Valeur de la version {}" -#: agenda_culturel/forms.py:661 +#: agenda_culturel/forms.py:662 msgid "Apply category {} to the event {}" msgstr "Appliquer la catégorie {} à l'événement {}" -#: agenda_culturel/forms.py:678 agenda_culturel/models.py:458 -#: agenda_culturel/models.py:1990 +#: agenda_culturel/forms.py:679 agenda_culturel/models.py:458 +#: agenda_culturel/models.py:2000 msgid "Place" msgstr "Lieu" -#: agenda_culturel/forms.py:680 +#: agenda_culturel/forms.py:681 msgid "Create a missing place" msgstr "Créer un lieu manquant" -#: agenda_culturel/forms.py:690 +#: agenda_culturel/forms.py:691 msgid "Add \"{}\" to the aliases of the place" msgstr "Ajouter « {} » aux alias du lieu" -#: agenda_culturel/forms.py:719 +#: agenda_culturel/forms.py:720 msgid "On saving, use aliases to detect all matching events with missing place" msgstr "" "Lors de l'enregistrement, utiliser des alias pour détecter tous les " @@ -289,7 +289,7 @@ msgstr "" #: agenda_culturel/models.py:56 agenda_culturel/models.py:104 #: agenda_culturel/models.py:185 agenda_culturel/models.py:402 #: agenda_culturel/models.py:430 agenda_culturel/models.py:511 -#: agenda_culturel/models.py:1694 agenda_culturel/models.py:1768 +#: agenda_culturel/models.py:1704 agenda_culturel/models.py:1778 msgid "Name" msgstr "Nom" @@ -518,7 +518,7 @@ msgstr "Organisme" msgid "Organisations" msgstr "Organismes" -#: agenda_culturel/models.py:552 agenda_culturel/models.py:1809 +#: agenda_culturel/models.py:552 agenda_culturel/models.py:1819 msgid "Published" msgstr "Publié" @@ -534,7 +534,7 @@ msgstr "Corbeille" msgid "Title" msgstr "Titre" -#: agenda_culturel/models.py:569 agenda_culturel/models.py:1906 +#: agenda_culturel/models.py:569 agenda_culturel/models.py:1916 msgid "Status" msgstr "Status" @@ -646,115 +646,124 @@ msgstr "Sujet" msgid "The subject of your message" msgstr "Sujet de votre message" -#: agenda_culturel/models.py:1695 +#: agenda_culturel/models.py:1696 +#| msgid "Duplicated events" +msgid "Related event" +msgstr "Événement associé" + +#: agenda_culturel/models.py:1697 +msgid "The message is associated with this event." +msgstr "Le message est associé à cet événement." + +#: agenda_culturel/models.py:1705 msgid "Your name" msgstr "Votre nom" -#: agenda_culturel/models.py:1701 +#: agenda_culturel/models.py:1711 msgid "Email address" msgstr "Adresse email" -#: agenda_culturel/models.py:1702 +#: agenda_culturel/models.py:1712 msgid "Your email address" msgstr "Votre adresse email" -#: agenda_culturel/models.py:1707 +#: agenda_culturel/models.py:1717 msgid "Message" msgstr "Message" -#: agenda_culturel/models.py:1707 +#: agenda_culturel/models.py:1717 msgid "Your message" msgstr "Votre message" -#: agenda_culturel/models.py:1713 +#: agenda_culturel/models.py:1723 msgid "This message is a spam." msgstr "Ce message est un spam." -#: agenda_culturel/models.py:1720 +#: agenda_culturel/models.py:1730 msgid "this message has been processed and no longer needs to be handled" msgstr "Ce message a été traité et ne nécessite plus d'être pris en charge" -#: agenda_culturel/models.py:1725 +#: agenda_culturel/models.py:1735 msgid "Comments" msgstr "Commentaires" -#: agenda_culturel/models.py:1726 +#: agenda_culturel/models.py:1736 msgid "Comments on the message from the moderation team" msgstr "Commentaires sur ce message par l'équipe de modération" -#: agenda_culturel/models.py:1738 agenda_culturel/models.py:1886 +#: agenda_culturel/models.py:1748 agenda_culturel/models.py:1896 msgid "Recurrent import" msgstr "Import récurrent" -#: agenda_culturel/models.py:1739 +#: agenda_culturel/models.py:1749 msgid "Recurrent imports" msgstr "Imports récurrents" -#: agenda_culturel/models.py:1743 +#: agenda_culturel/models.py:1753 msgid "ical" msgstr "ical" -#: agenda_culturel/models.py:1744 +#: agenda_culturel/models.py:1754 msgid "ical no busy" msgstr "ical sans busy" -#: agenda_culturel/models.py:1745 +#: agenda_culturel/models.py:1755 msgid "ical no VC" msgstr "ical sans VC" -#: agenda_culturel/models.py:1746 +#: agenda_culturel/models.py:1756 msgid "lacoope.org" msgstr "lacoope.org" -#: agenda_culturel/models.py:1747 +#: agenda_culturel/models.py:1757 msgid "la comédie" msgstr "la comédie" -#: agenda_culturel/models.py:1748 +#: agenda_culturel/models.py:1758 msgid "le fotomat" msgstr "le fotomat" -#: agenda_culturel/models.py:1749 +#: agenda_culturel/models.py:1759 msgid "la puce à l'oreille" msgstr "la puce à loreille" -#: agenda_culturel/models.py:1750 +#: agenda_culturel/models.py:1760 msgid "Plugin wordpress MEC" msgstr "Plugin wordpress MEC" -#: agenda_culturel/models.py:1751 +#: agenda_culturel/models.py:1761 msgid "Événements d'une page FB" msgstr "Événements d'une page FB" -#: agenda_culturel/models.py:1752 +#: agenda_culturel/models.py:1762 msgid "la cour des 3 coquins" msgstr "la cour des 3 coquins" -#: agenda_culturel/models.py:1753 +#: agenda_culturel/models.py:1763 msgid "Arachnée concert" msgstr "Arachnée concert" -#: agenda_culturel/models.py:1756 +#: agenda_culturel/models.py:1766 msgid "simple" msgstr "simple" -#: agenda_culturel/models.py:1757 +#: agenda_culturel/models.py:1767 msgid "Headless Chromium" msgstr "chromium sans interface" -#: agenda_culturel/models.py:1758 +#: agenda_culturel/models.py:1768 msgid "Headless Chromium (pause)" msgstr "chromium sans interface (pause)" -#: agenda_culturel/models.py:1763 +#: agenda_culturel/models.py:1773 msgid "daily" msgstr "chaque jour" -#: agenda_culturel/models.py:1765 +#: agenda_culturel/models.py:1775 msgid "weekly" msgstr "chaque semaine" -#: agenda_culturel/models.py:1770 +#: agenda_culturel/models.py:1780 msgid "" "Recurrent import name. Be careful to choose a name that is easy to " "understand, as it will be public and displayed on the sites About page." @@ -762,143 +771,143 @@ msgstr "" "Nom de l'import récurrent. Attention à choisir un nom compréhensible, car il " "sera public, et affiché sur la page à propos du site." -#: agenda_culturel/models.py:1777 +#: agenda_culturel/models.py:1787 msgid "Processor" msgstr "Processeur" -#: agenda_culturel/models.py:1780 +#: agenda_culturel/models.py:1790 msgid "Downloader" msgstr "Téléchargeur" -#: agenda_culturel/models.py:1787 +#: agenda_culturel/models.py:1797 msgid "Import recurrence" msgstr "Récurrence d'import" -#: agenda_culturel/models.py:1794 +#: agenda_culturel/models.py:1804 msgid "Source" msgstr "Source" -#: agenda_culturel/models.py:1795 +#: agenda_culturel/models.py:1805 msgid "URL of the source document" msgstr "URL du document source" -#: agenda_culturel/models.py:1799 +#: agenda_culturel/models.py:1809 msgid "Browsable url" msgstr "URL navigable" -#: agenda_culturel/models.py:1801 +#: agenda_culturel/models.py:1811 msgid "URL of the corresponding document that will be shown to visitors." msgstr "URL correspondant au document et qui sera montrée aux visiteurs" -#: agenda_culturel/models.py:1810 +#: agenda_culturel/models.py:1820 msgid "Status of each imported event (published or draft)" msgstr "Status de chaque événement importé (publié ou brouillon)" -#: agenda_culturel/models.py:1815 +#: agenda_culturel/models.py:1825 msgid "Address for each imported event" msgstr "Adresse de chaque événement importé" -#: agenda_culturel/models.py:1823 +#: agenda_culturel/models.py:1833 msgid "Organiser" msgstr "Organisateur" -#: agenda_culturel/models.py:1824 +#: agenda_culturel/models.py:1834 msgid "Organiser of each imported event" msgstr "Organisateur de chaque événement importé" -#: agenda_culturel/models.py:1834 +#: agenda_culturel/models.py:1844 msgid "Category of each imported event" msgstr "Catégorie de chaque événement importé" -#: agenda_culturel/models.py:1842 +#: agenda_culturel/models.py:1852 msgid "Tags for each imported event" msgstr "Étiquettes de chaque événement importé" -#: agenda_culturel/models.py:1843 +#: agenda_culturel/models.py:1853 msgid "A list of tags that describe each imported event." msgstr "Une liste d'étiquettes décrivant chaque événement importé" -#: agenda_culturel/models.py:1872 +#: agenda_culturel/models.py:1882 msgid "Running" msgstr "En cours" -#: agenda_culturel/models.py:1873 +#: agenda_culturel/models.py:1883 msgid "Canceled" msgstr "Annulé" -#: agenda_culturel/models.py:1874 +#: agenda_culturel/models.py:1884 msgid "Success" msgstr "Succès" -#: agenda_culturel/models.py:1875 +#: agenda_culturel/models.py:1885 msgid "Failed" msgstr "Erreur" -#: agenda_culturel/models.py:1878 +#: agenda_culturel/models.py:1888 msgid "Batch importation" msgstr "Importation par lot" -#: agenda_culturel/models.py:1879 +#: agenda_culturel/models.py:1889 msgid "Batch importations" msgstr "Importations par lot" -#: agenda_culturel/models.py:1887 +#: agenda_culturel/models.py:1897 msgid "Reference to the recurrent import processing" msgstr "Référence du processus d'import récurrent" -#: agenda_culturel/models.py:1895 +#: agenda_culturel/models.py:1905 msgid "URL (if not recurrent import)" msgstr "URL (si pas d'import récurrent)" -#: agenda_culturel/models.py:1897 +#: agenda_culturel/models.py:1907 msgid "Source URL if no RecurrentImport is associated." msgstr "URL source si aucun import récurrent n'est associé" -#: agenda_culturel/models.py:1910 +#: agenda_culturel/models.py:1920 msgid "Error message" msgstr "Votre message" -#: agenda_culturel/models.py:1914 +#: agenda_culturel/models.py:1924 msgid "Number of collected events" msgstr "Nombre d'événements collectés" -#: agenda_culturel/models.py:1917 +#: agenda_culturel/models.py:1927 msgid "Number of imported events" msgstr "Nombre d'événements importés" -#: agenda_culturel/models.py:1920 +#: agenda_culturel/models.py:1930 msgid "Number of updated events" msgstr "Nombre d'événements mis à jour" -#: agenda_culturel/models.py:1923 +#: agenda_culturel/models.py:1933 msgid "Number of removed events" msgstr "Nombre d'événements supprimés" -#: agenda_culturel/models.py:1931 +#: agenda_culturel/models.py:1941 msgid "Weight" msgstr "Poids" -#: agenda_culturel/models.py:1932 +#: agenda_culturel/models.py:1942 msgid "The lower is the weight, the earlier the filter is applied" msgstr "Plus le poids est léger, plus le filtre sera appliqué tôt" -#: agenda_culturel/models.py:1939 +#: agenda_culturel/models.py:1949 msgid "Category applied to the event" msgstr "Catégorie appliquée à l'événement" -#: agenda_culturel/models.py:1944 +#: agenda_culturel/models.py:1954 msgid "Contained in the title" msgstr "Contenu dans le titre" -#: agenda_culturel/models.py:1945 +#: agenda_culturel/models.py:1955 msgid "Text contained in the event title" msgstr "Texte contenu dans le titre de l'événement" -#: agenda_culturel/models.py:1951 +#: agenda_culturel/models.py:1961 msgid "Exact title extract" msgstr "Extrait exact du titre" -#: agenda_culturel/models.py:1953 +#: agenda_culturel/models.py:1963 msgid "" "If checked, the extract will be searched for in the title using the exact " "form (capitals, accents)." @@ -906,19 +915,19 @@ msgstr "" "Si coché, l'extrait sera recherché dans le titre en utilisant la forme " "exacte (majuscules, accents)" -#: agenda_culturel/models.py:1959 +#: agenda_culturel/models.py:1969 msgid "Contained in the description" msgstr "Contenu dans la description" -#: agenda_culturel/models.py:1960 +#: agenda_culturel/models.py:1970 msgid "Text contained in the description" msgstr "Texte contenu dans la description" -#: agenda_culturel/models.py:1966 +#: agenda_culturel/models.py:1976 msgid "Exact description extract" msgstr "Extrait exact de description" -#: agenda_culturel/models.py:1968 +#: agenda_culturel/models.py:1978 msgid "" "If checked, the extract will be searched for in the description using the " "exact form (capitals, accents)." @@ -926,19 +935,19 @@ msgstr "" "Si coché, l'extrait sera recherché dans la description en utilisant la forme " "exacte (majuscules, accents)" -#: agenda_culturel/models.py:1974 +#: agenda_culturel/models.py:1984 msgid "Contained in the location" msgstr "Contenu dans la localisation" -#: agenda_culturel/models.py:1975 +#: agenda_culturel/models.py:1985 msgid "Text contained in the event location" msgstr "Texte contenu dans la localisation de l'événement" -#: agenda_culturel/models.py:1981 +#: agenda_culturel/models.py:1991 msgid "Exact location extract" msgstr "Extrait exact de localisation" -#: agenda_culturel/models.py:1983 +#: agenda_culturel/models.py:1993 msgid "" "If checked, the extract will be searched for in the location using the exact " "form (capitals, accents)." @@ -946,15 +955,15 @@ msgstr "" "Si coché, l'extrait sera recherché dans la localisation en utilisant la " "forme exacte (majuscules, accents)" -#: agenda_culturel/models.py:1991 +#: agenda_culturel/models.py:2001 msgid "Location from place" msgstr "Localisation depuis le lieu" -#: agenda_culturel/models.py:2000 +#: agenda_culturel/models.py:2010 msgid "Categorisation rule" msgstr "Règle de catégorisation" -#: agenda_culturel/models.py:2001 +#: agenda_culturel/models.py:2011 msgid "Categorisation rules" msgstr "Règles de catégorisation" @@ -962,27 +971,27 @@ msgstr "Règles de catégorisation" msgid "French" msgstr "français" -#: agenda_culturel/views.py:146 +#: agenda_culturel/views.py:147 msgid "Recurrent import name" msgstr "Nome de l'import récurrent" -#: agenda_culturel/views.py:147 +#: agenda_culturel/views.py:148 msgid "Add another" msgstr "Ajouter un autre" -#: agenda_culturel/views.py:148 +#: agenda_culturel/views.py:149 msgid "Browse..." msgstr "Naviguer..." -#: agenda_culturel/views.py:149 +#: agenda_culturel/views.py:150 msgid "No file selected." msgstr "Pas de fichier sélectionné." -#: agenda_culturel/views.py:285 +#: agenda_culturel/views.py:286 msgid "The static content has been successfully updated." msgstr "Le contenu statique a été modifié avec succès." -#: agenda_culturel/views.py:293 +#: agenda_culturel/views.py:294 msgid "" "The event cannot be updated because the import process is not available for " "the referenced sources." @@ -990,33 +999,33 @@ msgstr "" "La mise à jour de l'événement n'est pas possible car le processus d'import " "n'est pas disponible pour les sources référencées." -#: agenda_culturel/views.py:296 +#: agenda_culturel/views.py:297 msgid "The event update has been queued and will be completed shortly." msgstr "" "La mise à jour de l'événement a été mise en attente et sera effectuée sous " "peu." -#: agenda_culturel/views.py:306 +#: agenda_culturel/views.py:307 msgid "The event has been successfully modified." msgstr "L'événement a été modifié avec succès." -#: agenda_culturel/views.py:351 +#: agenda_culturel/views.py:352 msgid "The event has been successfully moderated." msgstr "L'événement a été modéré avec succès." -#: agenda_culturel/views.py:445 +#: agenda_culturel/views.py:446 msgid "The event has been successfully deleted." msgstr "L'événement a été supprimé avec succès." -#: agenda_culturel/views.py:477 +#: agenda_culturel/views.py:478 msgid "The status has been successfully modified." msgstr "Le status a été modifié avec succès." -#: agenda_culturel/views.py:511 +#: agenda_culturel/views.py:512 msgid "The event was created: {}." msgstr "L'événement a été créé: {}." -#: agenda_culturel/views.py:513 agenda_culturel/views.py:537 +#: agenda_culturel/views.py:514 agenda_culturel/views.py:538 msgid "" "The event has been submitted and will be published as soon as it has been " "validated by the moderation team." @@ -1024,82 +1033,86 @@ msgstr "" "L'événement a été soumis et sera publié dès qu'il aura été validé par " "l'équipe de modération." -#: agenda_culturel/views.py:531 +#: agenda_culturel/views.py:532 msgid "The event is saved." msgstr "L'événement est enregistré." -#: agenda_culturel/views.py:625 agenda_culturel/views.py:677 +#: agenda_culturel/views.py:626 agenda_culturel/views.py:678 msgid "{} has not been submitted since its already known: {}." msgstr "{} n'a pas été soumis car il est déjà connu: {}." -#: agenda_culturel/views.py:630 agenda_culturel/views.py:683 +#: agenda_culturel/views.py:631 agenda_culturel/views.py:684 msgid "" "{} has not been submitted since its already known and currently into " "moderation process." msgstr "{} n'a pas été soumis car il est déjà connu et en cours de modération" -#: agenda_culturel/views.py:640 +#: agenda_culturel/views.py:641 msgid "Integrating {} url(s) into our import process." msgstr "Intégration de {} url(s) dans notre processus d'import." -#: agenda_culturel/views.py:690 +#: agenda_culturel/views.py:691 msgid "Integrating {} into our import process." msgstr "Intégration de {} dans notre processus d'import." -#: agenda_culturel/views.py:745 +#: agenda_culturel/views.py:746 msgid "Your message has been sent successfully." msgstr "Votre message a été envoyé avec succès." -#: agenda_culturel/views.py:755 +#: agenda_culturel/views.py:763 +msgid "Reporting the event {} on {}" +msgstr "Signaler l'événement {} du {}" + +#: agenda_culturel/views.py:771 msgid "The contact message has been successfully deleted." msgstr "Le message de contact a été supprimé avec succès." -#: agenda_culturel/views.py:769 +#: agenda_culturel/views.py:785 msgid "The contact message properties has been successfully modified." msgstr "Les propriétés du message de contact ont été modifié avec succès." -#: agenda_culturel/views.py:906 +#: agenda_culturel/views.py:922 msgid "Spam has been successfully deleted." msgstr "Le spam a été supprimé avec succès" -#: agenda_culturel/views.py:1029 +#: agenda_culturel/views.py:1045 msgid "The import has been run successfully." msgstr "L'import a été lancé avec succès" -#: agenda_culturel/views.py:1048 +#: agenda_culturel/views.py:1064 msgid "The import has been canceled." msgstr "L'import a été annulé" -#: agenda_culturel/views.py:1126 +#: agenda_culturel/views.py:1142 msgid "The recurrent import has been successfully modified." msgstr "L'import récurrent a été modifié avec succès." -#: agenda_culturel/views.py:1135 +#: agenda_culturel/views.py:1151 msgid "The recurrent import has been successfully deleted." msgstr "L'import récurrent a été supprimé avec succès" -#: agenda_culturel/views.py:1175 +#: agenda_culturel/views.py:1191 msgid "The import has been launched." msgstr "L'import a été lancé" -#: agenda_culturel/views.py:1197 +#: agenda_culturel/views.py:1213 msgid "Imports has been launched." msgstr "Les imports ont été lancés" -#: agenda_culturel/views.py:1259 +#: agenda_culturel/views.py:1275 msgid "Update successfully completed." msgstr "Mise à jour réalisée avec succès." -#: agenda_culturel/views.py:1320 +#: agenda_culturel/views.py:1336 msgid "Creation of a merged event has been successfully completed." msgstr "Création d'un événement fusionné réalisée avec succès." -#: agenda_culturel/views.py:1356 +#: agenda_culturel/views.py:1372 msgid "Events have been marked as unduplicated." msgstr "Les événements ont été marqués comme non dupliqués." -#: agenda_culturel/views.py:1370 agenda_culturel/views.py:1379 -#: agenda_culturel/views.py:1397 +#: agenda_culturel/views.py:1386 agenda_culturel/views.py:1395 +#: agenda_culturel/views.py:1413 msgid "" "The selected item is no longer included in the list of duplicates. Someone " "else has probably modified the list in the meantime." @@ -1107,23 +1120,23 @@ msgstr "" "L'élément sélectionné ne fait plus partie de la liste des dupliqués. Une " "autre personne a probablement modifié la liste entre temps." -#: agenda_culturel/views.py:1373 +#: agenda_culturel/views.py:1389 msgid "The selected event has been set as representative" msgstr "L'événement sélectionné a été défini comme representatif." -#: agenda_culturel/views.py:1388 +#: agenda_culturel/views.py:1404 msgid "The event has been withdrawn from the group and made independent." msgstr "L'événement a été retiré du groupe et rendu indépendant." -#: agenda_culturel/views.py:1432 +#: agenda_culturel/views.py:1448 msgid "Cleaning up duplicates: {} item(s) fixed." msgstr "Nettoyage des dupliqués: {} élément(s) corrigé(s)." -#: agenda_culturel/views.py:1481 +#: agenda_culturel/views.py:1497 msgid "The event was successfully duplicated." msgstr "L'événement a été marqué dupliqué avec succès." -#: agenda_culturel/views.py:1489 +#: agenda_culturel/views.py:1505 msgid "" "The event has been successfully flagged as a duplicate. The moderation team " "will deal with your suggestion shortly." @@ -1131,32 +1144,32 @@ msgstr "" "L'événement a été signalé comme dupliqué avec succès. Votre suggestion sera " "prochainement prise en charge par l'équipe de modération." -#: agenda_culturel/views.py:1542 +#: agenda_culturel/views.py:1558 msgid "The categorisation rule has been successfully modified." msgstr "La règle de catégorisation a été modifiée avec succès." -#: agenda_culturel/views.py:1551 +#: agenda_culturel/views.py:1567 msgid "The categorisation rule has been successfully deleted." msgstr "La règle de catégorisation a été supprimée avec succès" -#: agenda_culturel/views.py:1573 +#: agenda_culturel/views.py:1589 msgid "The rules were successfully applied and 1 event was categorised." msgstr "" "Les règles ont été appliquées avec succès et 1 événement a été catégorisé" -#: agenda_culturel/views.py:1580 +#: agenda_culturel/views.py:1596 msgid "The rules were successfully applied and {} events were categorised." msgstr "" "Les règles ont été appliquées avec succès et {} événements ont été " "catégorisés" -#: agenda_culturel/views.py:1587 agenda_culturel/views.py:1640 +#: agenda_culturel/views.py:1603 agenda_culturel/views.py:1656 msgid "The rules were successfully applied and no events were categorised." msgstr "" "Les règles ont été appliquées avec succès et aucun événement n'a été " "catégorisé" -#: agenda_culturel/views.py:1626 +#: agenda_culturel/views.py:1642 msgid "" "The rules were successfully applied and 1 event with default category was " "categorised." @@ -1164,7 +1177,7 @@ msgstr "" "Les règles ont été appliquées avec succès et 1 événement avec catégorie par " "défaut a été catégorisé" -#: agenda_culturel/views.py:1633 +#: agenda_culturel/views.py:1649 msgid "" "The rules were successfully applied and {} events with default category were " "categorised." @@ -1172,58 +1185,58 @@ msgstr "" "Les règles ont été appliquées avec succès et {} événements avec catégorie " "par défaut ont été catégorisés" -#: agenda_culturel/views.py:1725 agenda_culturel/views.py:1787 -#: agenda_culturel/views.py:1825 +#: agenda_culturel/views.py:1741 agenda_culturel/views.py:1803 +#: agenda_culturel/views.py:1841 msgid "{} events have been updated." msgstr "{} événements ont été mis à jour." -#: agenda_culturel/views.py:1728 agenda_culturel/views.py:1789 -#: agenda_culturel/views.py:1828 +#: agenda_culturel/views.py:1744 agenda_culturel/views.py:1805 +#: agenda_culturel/views.py:1844 msgid "1 event has been updated." msgstr "1 événement a été mis à jour" -#: agenda_culturel/views.py:1730 agenda_culturel/views.py:1791 -#: agenda_culturel/views.py:1830 +#: agenda_culturel/views.py:1746 agenda_culturel/views.py:1807 +#: agenda_culturel/views.py:1846 msgid "No events have been modified." msgstr "Aucun événement n'a été modifié." -#: agenda_culturel/views.py:1739 +#: agenda_culturel/views.py:1755 msgid "The place has been successfully updated." msgstr "Le lieu a été modifié avec succès." -#: agenda_culturel/views.py:1748 +#: agenda_culturel/views.py:1764 msgid "The place has been successfully created." msgstr "Le lieu a été créé avec succès." -#: agenda_culturel/views.py:1813 +#: agenda_culturel/views.py:1829 msgid "The selected place has been assigned to the event." msgstr "Le lieu sélectionné a été assigné à l'événement." -#: agenda_culturel/views.py:1817 +#: agenda_culturel/views.py:1833 msgid "A new alias has been added to the selected place." msgstr "Un nouvel alias a été créé pour le lieu sélectionné." -#: agenda_culturel/views.py:1910 +#: agenda_culturel/views.py:1926 msgid "The organisation has been successfully updated." msgstr "L'organisme a été modifié avec succès." -#: agenda_culturel/views.py:1919 +#: agenda_culturel/views.py:1935 msgid "The organisation has been successfully created." msgstr "L'organisme a été créé avec succès." -#: agenda_culturel/views.py:1936 +#: agenda_culturel/views.py:1952 msgid "The tag has been successfully updated." msgstr "L'étiquette a été modifiée avec succès." -#: agenda_culturel/views.py:1943 +#: agenda_culturel/views.py:1959 msgid "The tag has been successfully created." msgstr "L'étiquette a été créée avec succès." -#: agenda_culturel/views.py:2007 +#: agenda_culturel/views.py:2023 msgid "You have not modified the tag name." msgstr "Vous n'avez pas modifié le nom de l'étiquette." -#: agenda_culturel/views.py:2017 +#: agenda_culturel/views.py:2033 msgid "" "This tag {} is already in use, and is described by different information " "from the current tag. You can force renaming by checking the corresponding " @@ -1236,7 +1249,7 @@ msgstr "" "sera supprimée, et tous les événements associés à l'étiquette {} seront " "associés à l'étiquette {}." -#: agenda_culturel/views.py:2024 +#: agenda_culturel/views.py:2040 msgid "" "This tag {} is already in use. You can force renaming by checking the " "corresponding option." @@ -1244,10 +1257,10 @@ msgstr "" "Cette étiquette {} est déjà utilisée. Vous pouvez forcer le renommage en " "cochant l'option correspondante." -#: agenda_culturel/views.py:2058 +#: agenda_culturel/views.py:2074 msgid "The tag {} has been successfully renamed to {}." msgstr "L'étiquette {} a été renommée avec succès en {}." -#: agenda_culturel/views.py:2096 +#: agenda_culturel/views.py:2112 msgid "The tag {} has been successfully deleted." msgstr "L'événement {} a été supprimé avec succès." diff --git a/src/agenda_culturel/migrations/0121_contactmessage_related_event.py b/src/agenda_culturel/migrations/0121_contactmessage_related_event.py new file mode 100644 index 0000000..e40e5a3 --- /dev/null +++ b/src/agenda_culturel/migrations/0121_contactmessage_related_event.py @@ -0,0 +1,19 @@ +# Generated by Django 4.2.9 on 2024-11-27 22:13 + +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = [ + ('agenda_culturel', '0120_referencelocation_suggested_distance'), + ] + + operations = [ + migrations.AddField( + model_name='contactmessage', + name='related_event', + field=models.ForeignKey(default=None, help_text='The message is associated with this event.', null=True, on_delete=django.db.models.deletion.SET_DEFAULT, to='agenda_culturel.event', verbose_name='Related event'), + ), + ] diff --git a/src/agenda_culturel/models.py b/src/agenda_culturel/models.py index 218b874..d7b3909 100644 --- a/src/agenda_culturel/models.py +++ b/src/agenda_culturel/models.py @@ -1690,6 +1690,16 @@ class ContactMessage(models.Model): help_text=_("The subject of your message"), max_length=512, ) + + related_event = models.ForeignKey( + Event, + verbose_name=_("Related event"), + help_text=_("The message is associated with this event."), + null=True, + default=None, + on_delete=models.SET_DEFAULT, + ) + name = models.CharField( verbose_name=_("Name"), help_text=_("Your name"), @@ -1732,6 +1742,9 @@ class ContactMessage(models.Model): def nb_open_contactmessages(): return ContactMessage.objects.filter(closed=False).count() + def get_absolute_url(self): + return reverse("contactmessage", kwargs={"pk": self.pk}) + class RecurrentImport(models.Model): class Meta: diff --git a/src/agenda_culturel/templates/agenda_culturel/contactmessage_create_form.html b/src/agenda_culturel/templates/agenda_culturel/contactmessage_create_form.html index b67047b..e91208d 100644 --- a/src/agenda_culturel/templates/agenda_culturel/contactmessage_create_form.html +++ b/src/agenda_culturel/templates/agenda_culturel/contactmessage_create_form.html @@ -1,7 +1,8 @@ {% extends "agenda_culturel/page-admin.html" %} {% load static %} -{% block title %}{% block og_title %}Contact{% endblock %}{% endblock %} +{% block title %}{% block og_title %}{% if form.event %}Contact au sujet de l'événement {{ form.event.title }}{% else %} +Contact{% endif %}{% endblock %}{% endblock %} {% block entete_header %} @@ -17,16 +18,26 @@ {% block content %} -

Contact

- -
-{% url 'contact' as local_url %} -{% include "agenda_culturel/static_content.html" with name="contact" url_path=local_url %} -
+

{% if form.event %}Contact au sujet de l'événement « {{ form.event.title }} »{% else %} + Contact{% endif %}

+ + {% if not form.event %} +
+ {% url 'contact' as local_url %} + {% include "agenda_culturel/static_content.html" with name="contact" url_path=local_url %} +
+ {% endif %} +

Attention : n'utilisez pas le formulaire ci-dessous pour proposer un événement, il sera ignoré. Utilisez plutôt la page ajouter un événement.

+ {% if form.event %} +

Tu nous contactes au sujet de l'événement « {{ form.event.title }} » du {{ form.event.start_day }}. + N'hésites pas à nous indiquer le maximum de contexte et à nous laisser ton adresse + afin que l'on puisse répondre à tes demandes ou remarques. +

+ {% endif %}
{% csrf_token %} {{ form.media }} diff --git a/src/agenda_culturel/templates/agenda_culturel/contactmessage_moderation_form.html b/src/agenda_culturel/templates/agenda_culturel/contactmessage_moderation_form.html index aa21e30..52bc8fe 100644 --- a/src/agenda_culturel/templates/agenda_culturel/contactmessage_moderation_form.html +++ b/src/agenda_culturel/templates/agenda_culturel/contactmessage_moderation_form.html @@ -29,12 +29,13 @@

Modération du message « {{ object.subject }} »

    -
  • Date : {{ object.date }}
  • -
  • Auteur : {{ object.name }} {{ object.email }}
  • +
  • Date : {{ object.date.date }} à {{ object.date.time }}
  • +
  • Auteur : {{ object.name }} {% if object.email %}{{ object.email }}{% endif %}
  • + {% if object.related_event %}
  • Événement associé : {{ object.related_event.title }} du {{ object.related_event.start_day }}
  • {% endif %}
- {{ object.message }} + {{ object.message | safe }}
diff --git a/src/agenda_culturel/templates/agenda_culturel/contactmessages.html b/src/agenda_culturel/templates/agenda_culturel/contactmessages.html index 69cb19c..b50e379 100644 --- a/src/agenda_culturel/templates/agenda_culturel/contactmessages.html +++ b/src/agenda_culturel/templates/agenda_culturel/contactmessages.html @@ -36,6 +36,7 @@ Date Sujet Auteur + Événement Fermé Spam @@ -46,6 +47,7 @@ {{ obj.date }} {{ obj.subject }} {{ obj.name }} + {% if obj.related_event %}{{ obj.related_event.pk }}{% else %}/{% endif %} {% if obj.closed %}{% picto_from_name "check-square" "fermé" %}{% else %}{% picto_from_name "square" "ouvert" %}{% endif %} {% if obj.spam %}{% picto_from_name "check-square" "spam" %}{% else %}{% picto_from_name "square" "non spam" %}{% endif %} diff --git a/src/agenda_culturel/templates/agenda_culturel/page-event.html b/src/agenda_culturel/templates/agenda_culturel/page-event.html index 2d25101..142defe 100644 --- a/src/agenda_culturel/templates/agenda_culturel/page-event.html +++ b/src/agenda_culturel/templates/agenda_culturel/page-event.html @@ -122,7 +122,8 @@ {% else %} Signaler comme doublon {% endif %} - + Signaler cet événement + diff --git a/src/agenda_culturel/templates/agenda_culturel/single-event/event-single-inc.html b/src/agenda_culturel/templates/agenda_culturel/single-event/event-single-inc.html index bb6175f..7482ee2 100644 --- a/src/agenda_culturel/templates/agenda_culturel/single-event/event-single-inc.html +++ b/src/agenda_culturel/templates/agenda_culturel/single-event/event-single-inc.html @@ -75,6 +75,15 @@

{% endif %} {% endif %} + {% if perms.agenda_culturel.change_contactmessage %} + {% if event.contactmessage_set.all.count > 0 %} +

Cet événement a fait l'objet {% if event.contactmessage_set.all.count == 1 %}d'un signalement{% else %}de signalements{% endif %} + {% for cm in event.contactmessage_set.all %} + le {{ cm.date.date }} à {{ cm.date.time }}{% if not forloop.last %}, {% endif %} + {% endfor %} +

+ {% endif %} + {% endif %}
diff --git a/src/agenda_culturel/urls.py b/src/agenda_culturel/urls.py index f8b5765..d6f266c 100644 --- a/src/agenda_culturel/urls.py +++ b/src/agenda_culturel/urls.py @@ -40,6 +40,7 @@ urlpatterns = [ path("moderate", EventModerateView.as_view(), name="moderate"), path("event//simple-clone/edit", EventUpdateView.as_view(), name="simple_clone_edit"), path("event//clone/edit", EventUpdateView.as_view(), name="clone_edit"), + path("event//message", ContactMessageCreateView.as_view(), name="message_for_event"), path("event//update-from-source", update_from_source, name="update_from_source"), path( "event//change-status/", diff --git a/src/agenda_culturel/views.py b/src/agenda_culturel/views.py index bf3e4b1..59ad273 100644 --- a/src/agenda_culturel/views.py +++ b/src/agenda_culturel/views.py @@ -36,7 +36,8 @@ from .forms import ( MultipleHiddenInput, EventModerateForm, TagForm, - TagRenameForm + TagRenameForm, + ContactMessageForm, ) from .filters import ( @@ -739,7 +740,7 @@ def export_ical(request): class ContactMessageCreateView(SuccessMessageMixin, CreateView): model = ContactMessage template_name = "agenda_culturel/contactmessage_create_form.html" - fields = ["subject", "name", "email", "message"] + form_class = ContactMessageForm success_url = reverse_lazy("home") success_message = _("Your message has been sent successfully.") @@ -749,6 +750,21 @@ class ContactMessageCreateView(SuccessMessageMixin, CreateView): form_class = self.get_form_class() return form_class(**self.get_form_kwargs()) + def get_form_kwargs(self): + kwargs = super().get_form_kwargs() + kwargs["event"] = self.event + return kwargs + + def get_initial(self): + result = super().get_initial() + if "pk" in self.kwargs: + self.event = get_object_or_404(Event, pk=self.kwargs["pk"]) + result["related_event"] = self.event + result["subject"] = _('Reporting the event {} on {}').format(self.event.title, self.event.start_day) + return result + + + class ContactMessageDeleteView(SuccessMessageMixin, DeleteView): model = ContactMessage success_message = _(