AJout d'un message en cas d'événement trop long

Fix #259
This commit is contained in:
Jean-Marie Favreau 2024-12-22 15:53:59 +01:00
parent ca6c7889a5
commit 359451b9f8
3 changed files with 125 additions and 96 deletions

View File

@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: agenda_culturel\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-12-22 15:20+0100\n"
"POT-Creation-Date: 2024-12-22 15:52+0100\n"
"PO-Revision-Date: 2023-10-29 14:16+0000\n"
"Last-Translator: Jean-Marie Favreau <jeanmarie.favreau@free.fr>\n"
"Language-Team: Jean-Marie Favreau <jeanmarie.favreau@free.fr>\n"
@ -110,7 +110,7 @@ msgstr "Non"
msgid "Imported from"
msgstr "Importé depuis"
#: agenda_culturel/filters.py:367 agenda_culturel/models.py:1839
#: agenda_culturel/filters.py:367 agenda_culturel/models.py:1852
msgid "Closed"
msgstr "Fermé"
@ -118,7 +118,7 @@ msgstr "Fermé"
msgid "Open"
msgstr "Ouvert"
#: agenda_culturel/filters.py:372 agenda_culturel/models.py:1833
#: agenda_culturel/filters.py:372 agenda_culturel/models.py:1846
msgid "Spam"
msgstr "Spam"
@ -146,8 +146,8 @@ msgstr ""
"l'étiquette choisie."
#: agenda_culturel/forms.py:133 agenda_culturel/models.py:178
#: agenda_culturel/models.py:620 agenda_culturel/models.py:1964
#: agenda_culturel/models.py:2074
#: agenda_culturel/models.py:620 agenda_culturel/models.py:1977
#: agenda_culturel/models.py:2087
msgid "Category"
msgstr "Catégorie"
@ -178,7 +178,7 @@ msgid "Details"
msgstr "Détails"
#: agenda_culturel/forms.py:276 agenda_culturel/models.py:650
#: agenda_culturel/models.py:1939
#: agenda_culturel/models.py:1952
msgid "Location"
msgstr "Localisation"
@ -255,7 +255,7 @@ msgstr "Rendre {} indépendant."
msgid "Make all versions independent."
msgstr "Rendre toutes les versions indépendantes."
#: agenda_culturel/forms.py:496 agenda_culturel/models.py:803
#: agenda_culturel/forms.py:496 agenda_culturel/models.py:812
msgid "Event"
msgstr "Événement"
@ -272,7 +272,7 @@ msgid "Apply category {} to the event {}"
msgstr "Appliquer la catégorie {} à l'événement {}"
#: agenda_culturel/forms.py:693 agenda_culturel/models.py:466
#: agenda_culturel/models.py:2126
#: agenda_culturel/models.py:2139
msgid "Place"
msgstr "Lieu"
@ -313,7 +313,7 @@ msgstr "Ajouter un commentaire"
#: agenda_culturel/models.py:59 agenda_culturel/models.py:107
#: agenda_culturel/models.py:188 agenda_culturel/models.py:409
#: agenda_culturel/models.py:437 agenda_culturel/models.py:524
#: agenda_culturel/models.py:1815 agenda_culturel/models.py:1893
#: agenda_culturel/models.py:1828 agenda_culturel/models.py:1906
msgid "Name"
msgstr "Nom"
@ -550,7 +550,7 @@ msgstr "Organisme"
msgid "Organisations"
msgstr "Organismes"
#: agenda_culturel/models.py:565 agenda_culturel/models.py:1934
#: agenda_culturel/models.py:565 agenda_culturel/models.py:1947
msgid "Published"
msgstr "Publié"
@ -582,7 +582,7 @@ msgstr "Auteur de la dernière modération"
msgid "Title"
msgstr "Titre"
#: agenda_culturel/models.py:615 agenda_culturel/models.py:2042
#: agenda_culturel/models.py:615 agenda_culturel/models.py:2055
msgid "Status"
msgstr "Status"
@ -674,147 +674,163 @@ msgstr "Liste de toutes les urls où l'événement peut être trouvé."
msgid "Other versions"
msgstr ""
#: agenda_culturel/models.py:804
#: agenda_culturel/models.py:813
msgid "Events"
msgstr "Événements"
#: agenda_culturel/models.py:1780 agenda_culturel/models.py:1828
#: agenda_culturel/models.py:1597
msgid ""
"The duration of the event is a little too long for direct publication. "
"Moderators can choose to publish it or not."
msgstr ""
"La durée de l'événement est un peu trop longue pour qu'il soit publié "
"directement. Les modérateurs peuvent choisir de le publier ou non."
#: agenda_culturel/models.py:1606
msgid "Import"
msgstr "Import"
#: agenda_culturel/models.py:1606
msgid "import process"
msgstr "processus d'import"
#: agenda_culturel/models.py:1793 agenda_culturel/models.py:1841
msgid "Message"
msgstr "Message"
#: agenda_culturel/models.py:1781
#: agenda_culturel/models.py:1794
msgid "Messages"
msgstr "Messages"
#: agenda_culturel/models.py:1792
#: agenda_culturel/models.py:1805
msgid "Subject"
msgstr "Sujet"
#: agenda_culturel/models.py:1793
#: agenda_culturel/models.py:1806
msgid "The subject of your message"
msgstr "Sujet de votre message"
#: agenda_culturel/models.py:1799
#: agenda_culturel/models.py:1812
msgid "Related event"
msgstr "Événement associé"
#: agenda_culturel/models.py:1800
#: agenda_culturel/models.py:1813
msgid "The message is associated with this event."
msgstr "Le message est associé à cet événement."
#: agenda_culturel/models.py:1808
#: agenda_culturel/models.py:1821
msgid "Author of the message"
msgstr "Auteur du message"
#: agenda_culturel/models.py:1816
#: agenda_culturel/models.py:1829
msgid "Your name"
msgstr "Votre nom"
#: agenda_culturel/models.py:1822
#: agenda_culturel/models.py:1835
msgid "Email address"
msgstr "Adresse email"
#: agenda_culturel/models.py:1823
#: agenda_culturel/models.py:1836
msgid "Your email address"
msgstr "Votre adresse email"
#: agenda_culturel/models.py:1828
#: agenda_culturel/models.py:1841
msgid "Your message"
msgstr "Votre message"
#: agenda_culturel/models.py:1834
#: agenda_culturel/models.py:1847
msgid "This message is a spam."
msgstr "Ce message est un spam."
#: agenda_culturel/models.py:1841
#: agenda_culturel/models.py:1854
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:1846
#: agenda_culturel/models.py:1859
msgid "Comments"
msgstr "Commentaires"
#: agenda_culturel/models.py:1847
#: agenda_culturel/models.py:1860
msgid "Comments on the message from the moderation team"
msgstr "Commentaires sur ce message par l'équipe de modération"
#: agenda_culturel/models.py:1862 agenda_culturel/models.py:2022
#: agenda_culturel/models.py:1875 agenda_culturel/models.py:2035
msgid "Recurrent import"
msgstr "Import récurrent"
#: agenda_culturel/models.py:1863
#: agenda_culturel/models.py:1876
msgid "Recurrent imports"
msgstr "Imports récurrents"
#: agenda_culturel/models.py:1867
#: agenda_culturel/models.py:1880
msgid "ical"
msgstr "ical"
#: agenda_culturel/models.py:1868
#: agenda_culturel/models.py:1881
msgid "ical no busy"
msgstr "ical sans busy"
#: agenda_culturel/models.py:1869
#: agenda_culturel/models.py:1882
msgid "ical no VC"
msgstr "ical sans VC"
#: agenda_culturel/models.py:1870
#: agenda_culturel/models.py:1883
msgid "lacoope.org"
msgstr "lacoope.org"
#: agenda_culturel/models.py:1871
#: agenda_culturel/models.py:1884
msgid "la comédie"
msgstr "la comédie"
#: agenda_culturel/models.py:1872
#: agenda_culturel/models.py:1885
msgid "le fotomat"
msgstr "le fotomat"
#: agenda_culturel/models.py:1873
#: agenda_culturel/models.py:1886
msgid "la puce à l'oreille"
msgstr "la puce à loreille"
#: agenda_culturel/models.py:1874
#: agenda_culturel/models.py:1887
msgid "Plugin wordpress MEC"
msgstr "Plugin wordpress MEC"
#: agenda_culturel/models.py:1875
#: agenda_culturel/models.py:1888
msgid "Événements d'une page FB"
msgstr "Événements d'une page FB"
#: agenda_culturel/models.py:1876
#: agenda_culturel/models.py:1889
msgid "la cour des 3 coquins"
msgstr "la cour des 3 coquins"
#: agenda_culturel/models.py:1877
#: agenda_culturel/models.py:1890
msgid "Arachnée concert"
msgstr "Arachnée concert"
#: agenda_culturel/models.py:1878
#: agenda_culturel/models.py:1891
msgid "Le Rio"
msgstr "Le Rio"
#: agenda_culturel/models.py:1881
#: agenda_culturel/models.py:1894
msgid "simple"
msgstr "simple"
#: agenda_culturel/models.py:1882
#: agenda_culturel/models.py:1895
msgid "Headless Chromium"
msgstr "chromium sans interface"
#: agenda_culturel/models.py:1883
#: agenda_culturel/models.py:1896
msgid "Headless Chromium (pause)"
msgstr "chromium sans interface (pause)"
#: agenda_culturel/models.py:1888
#: agenda_culturel/models.py:1901
msgid "daily"
msgstr "chaque jour"
#: agenda_culturel/models.py:1890
#: agenda_culturel/models.py:1903
msgid "weekly"
msgstr "chaque semaine"
#: agenda_culturel/models.py:1895
#: agenda_culturel/models.py:1908
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."
@ -822,151 +838,151 @@ 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:1902
#: agenda_culturel/models.py:1915
msgid "Processor"
msgstr "Processeur"
#: agenda_culturel/models.py:1905
#: agenda_culturel/models.py:1918
msgid "Downloader"
msgstr "Téléchargeur"
#: agenda_culturel/models.py:1912
#: agenda_culturel/models.py:1925
msgid "Import recurrence"
msgstr "Récurrence d'import"
#: agenda_culturel/models.py:1919
#: agenda_culturel/models.py:1932
msgid "Source"
msgstr "Source"
#: agenda_culturel/models.py:1920
#: agenda_culturel/models.py:1933
msgid "URL of the source document"
msgstr "URL du document source"
#: agenda_culturel/models.py:1924
#: agenda_culturel/models.py:1937
msgid "Browsable url"
msgstr "URL navigable"
#: agenda_culturel/models.py:1926
#: agenda_culturel/models.py:1939
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:1935
#: agenda_culturel/models.py:1948
msgid "Status of each imported event (published or draft)"
msgstr "Status de chaque événement importé (publié ou brouillon)"
#: agenda_culturel/models.py:1940
#: agenda_culturel/models.py:1953
msgid "Address for each imported event"
msgstr "Adresse de chaque événement importé"
#: agenda_culturel/models.py:1947
#: agenda_culturel/models.py:1960
msgid "Force location"
msgstr "Focer la localisation"
#: agenda_culturel/models.py:1948
#: agenda_culturel/models.py:1961
msgid "force location even if another is detected."
msgstr "Forcer la localisation même si une autre a été détectée."
#: agenda_culturel/models.py:1954
#: agenda_culturel/models.py:1967
msgid "Organiser"
msgstr "Organisateur"
#: agenda_culturel/models.py:1955
#: agenda_culturel/models.py:1968
msgid "Organiser of each imported event"
msgstr "Organisateur de chaque événement importé"
#: agenda_culturel/models.py:1965
#: agenda_culturel/models.py:1978
msgid "Category of each imported event"
msgstr "Catégorie de chaque événement importé"
#: agenda_culturel/models.py:1973
#: agenda_culturel/models.py:1986
msgid "Tags for each imported event"
msgstr "Étiquettes de chaque événement importé"
#: agenda_culturel/models.py:1974
#: agenda_culturel/models.py:1987
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:2003
#: agenda_culturel/models.py:2016
msgid "Running"
msgstr "En cours"
#: agenda_culturel/models.py:2004
#: agenda_culturel/models.py:2017
msgid "Canceled"
msgstr "Annulé"
#: agenda_culturel/models.py:2005
#: agenda_culturel/models.py:2018
msgid "Success"
msgstr "Succès"
#: agenda_culturel/models.py:2006
#: agenda_culturel/models.py:2019
msgid "Failed"
msgstr "Erreur"
#: agenda_culturel/models.py:2009
#: agenda_culturel/models.py:2022
msgid "Batch importation"
msgstr "Importation par lot"
#: agenda_culturel/models.py:2010
#: agenda_culturel/models.py:2023
msgid "Batch importations"
msgstr "Importations par lot"
#: agenda_culturel/models.py:2023
#: agenda_culturel/models.py:2036
msgid "Reference to the recurrent import processing"
msgstr "Référence du processus d'import récurrent"
#: agenda_culturel/models.py:2031
#: agenda_culturel/models.py:2044
msgid "URL (if not recurrent import)"
msgstr "URL (si pas d'import récurrent)"
#: agenda_culturel/models.py:2033
#: agenda_culturel/models.py:2046
msgid "Source URL if no RecurrentImport is associated."
msgstr "URL source si aucun import récurrent n'est associé"
#: agenda_culturel/models.py:2046
#: agenda_culturel/models.py:2059
msgid "Error message"
msgstr "Votre message"
#: agenda_culturel/models.py:2050
#: agenda_culturel/models.py:2063
msgid "Number of collected events"
msgstr "Nombre d'événements collectés"
#: agenda_culturel/models.py:2053
#: agenda_culturel/models.py:2066
msgid "Number of imported events"
msgstr "Nombre d'événements importés"
#: agenda_culturel/models.py:2056
#: agenda_culturel/models.py:2069
msgid "Number of updated events"
msgstr "Nombre d'événements mis à jour"
#: agenda_culturel/models.py:2059
#: agenda_culturel/models.py:2072
msgid "Number of removed events"
msgstr "Nombre d'événements supprimés"
#: agenda_culturel/models.py:2067
#: agenda_culturel/models.py:2080
msgid "Weight"
msgstr "Poids"
#: agenda_culturel/models.py:2068
#: agenda_culturel/models.py:2081
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:2075
#: agenda_culturel/models.py:2088
msgid "Category applied to the event"
msgstr "Catégorie appliquée à l'événement"
#: agenda_culturel/models.py:2080
#: agenda_culturel/models.py:2093
msgid "Contained in the title"
msgstr "Contenu dans le titre"
#: agenda_culturel/models.py:2081
#: agenda_culturel/models.py:2094
msgid "Text contained in the event title"
msgstr "Texte contenu dans le titre de l'événement"
#: agenda_culturel/models.py:2087
#: agenda_culturel/models.py:2100
msgid "Exact title extract"
msgstr "Extrait exact du titre"
#: agenda_culturel/models.py:2089
#: agenda_culturel/models.py:2102
msgid ""
"If checked, the extract will be searched for in the title using the exact "
"form (capitals, accents)."
@ -974,19 +990,19 @@ msgstr ""
"Si coché, l'extrait sera recherché dans le titre en utilisant la forme "
"exacte (majuscules, accents)"
#: agenda_culturel/models.py:2095
#: agenda_culturel/models.py:2108
msgid "Contained in the description"
msgstr "Contenu dans la description"
#: agenda_culturel/models.py:2096
#: agenda_culturel/models.py:2109
msgid "Text contained in the description"
msgstr "Texte contenu dans la description"
#: agenda_culturel/models.py:2102
#: agenda_culturel/models.py:2115
msgid "Exact description extract"
msgstr "Extrait exact de description"
#: agenda_culturel/models.py:2104
#: agenda_culturel/models.py:2117
msgid ""
"If checked, the extract will be searched for in the description using the "
"exact form (capitals, accents)."
@ -994,19 +1010,19 @@ msgstr ""
"Si coché, l'extrait sera recherché dans la description en utilisant la forme "
"exacte (majuscules, accents)"
#: agenda_culturel/models.py:2110
#: agenda_culturel/models.py:2123
msgid "Contained in the location"
msgstr "Contenu dans la localisation"
#: agenda_culturel/models.py:2111
#: agenda_culturel/models.py:2124
msgid "Text contained in the event location"
msgstr "Texte contenu dans la localisation de l'événement"
#: agenda_culturel/models.py:2117
#: agenda_culturel/models.py:2130
msgid "Exact location extract"
msgstr "Extrait exact de localisation"
#: agenda_culturel/models.py:2119
#: agenda_culturel/models.py:2132
msgid ""
"If checked, the extract will be searched for in the location using the exact "
"form (capitals, accents)."
@ -1014,15 +1030,15 @@ msgstr ""
"Si coché, l'extrait sera recherché dans la localisation en utilisant la "
"forme exacte (majuscules, accents)"
#: agenda_culturel/models.py:2127
#: agenda_culturel/models.py:2140
msgid "Location from place"
msgstr "Localisation depuis le lieu"
#: agenda_culturel/models.py:2136
#: agenda_culturel/models.py:2149
msgid "Categorisation rule"
msgstr "Règle de catégorisation"
#: agenda_culturel/models.py:2137
#: agenda_culturel/models.py:2150
msgid "Categorisation rules"
msgstr "Règles de catégorisation"

View File

@ -768,6 +768,15 @@ class Event(models.Model):
end_date = parse_date(end_date)
return parse_date(self.start_day) + timedelta(days=min_days) < end_date
def set_message(self, msg):
self._message = msg
def get_message(self):
return self._message
def has_message(self):
return hasattr(self, '_message')
def contains_date(self, d, intuitive=True):
return d >= self.start_day and d <= self.get_consolidated_end_day(intuitive)
@ -1585,6 +1594,7 @@ class Event(models.Model):
for e in to_import:
if e.is_event_long_duration():
e.status = Event.STATUS.DRAFT
e.set_message(_("The duration of the event is a little too long for direct publication. Moderators can choose to publish it or not."))
# then import all the new events
imported = Event.objects.bulk_create(to_import)
@ -1592,6 +1602,9 @@ class Event(models.Model):
for i, ti in zip(imported, to_import):
if ti.has_pending_organisers() and ti.pending_organisers is not None:
i.organisers.set(ti.pending_organisers)
if ti.has_message():
msg = Message(subject=_('Import'), related_event=i, name=_('import process'), message=ti.get_message())
msg.save()
nb_updated = Event.objects.bulk_update(
to_update,

View File

@ -47,7 +47,7 @@
<div class="entree">
<div><span class="ts">{{ step.timestamp }}</span></div>
<div>
<header><strong>Message</strong>{% if step.data.related_event and event != step.data.related_event %} sur <a href="{{ step.data.related_event.get_absolute_url }}">une autre</a> version{% endif %}&nbsp;: <a href="{{ step.data.get_absolute_url }}">{{ step.data.subject|truncatechars:20 }}</a> {% if step.data.user %} par <em>{{ step.data.user }}</em>{% else %} par {{ step.data.name }} (<a href="mailto: {{ step.data.email }}">{{ step.data.email }}</a>){% endif %}</header>
<header><strong>Message</strong>{% if step.data.related_event and event != step.data.related_event %} sur <a href="{{ step.data.related_event.get_absolute_url }}">une autre</a> version{% endif %}&nbsp;: <a href="{{ step.data.get_absolute_url }}">{{ step.data.subject|truncatechars:20 }}</a> {% if step.data.user %} par <em>{{ step.data.user }}</em>{% else %} par {{ step.data.name }}{% if step.data.email %} (<a href="mailto: {{ step.data.email }}">{{ step.data.email }}</a>){% endif %}{% endif %}</header>
<div class="texte">{{ step.data.message|safe }}</div>
{% if step.data.comments %}
<div><strong>Commentaire&nbsp;:</strong> {{ step.data.comments }}</div>