From b38717e52b6a093d266ade3c3afd96d441c7b54f Mon Sep 17 00:00:00 2001 From: Jean-Marie Favreau Date: Thu, 17 Oct 2024 23:18:54 +0200 Subject: [PATCH] =?UTF-8?q?Ajout=20d'un=20bouton=20de=20r=C3=A9import?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/agenda_culturel/celery.py | 6 +- .../locale/fr/LC_MESSAGES/django.po | 434 +++++++++--------- src/agenda_culturel/models.py | 11 + .../agenda_culturel/edit-buttons-inc.html | 6 + src/agenda_culturel/urls.py | 1 + src/agenda_culturel/views.py | 12 + 6 files changed, 256 insertions(+), 214 deletions(-) diff --git a/src/agenda_culturel/celery.py b/src/agenda_culturel/celery.py index c51cfd6..27c87f7 100644 --- a/src/agenda_culturel/celery.py +++ b/src/agenda_culturel/celery.py @@ -286,7 +286,7 @@ def weekly_imports(self): run_recurrent_imports_from_list([imp.pk for imp in imports]) @app.task(base=ChromiumTask, bind=True) -def import_events_from_url(self, url, cat): +def import_events_from_url(self, url, cat, force=False): from .db_importer import DBImporterEvents from agenda_culturel.models import RecurrentImport, BatchImportation from agenda_culturel.models import Event, Category @@ -302,9 +302,9 @@ def import_events_from_url(self, url, cat): url = Extractor.clean_url(url) # we check if the url is known - existing = Event.objects.filter(uuids__contains=[url]) + existing = None if force else Event.objects.filter(uuids__contains=[url]) # if it's unknown - if len(existing) == 0: + if force or len(existing) == 0: # create an importer importer = DBImporterEvents(self.request.id) diff --git a/src/agenda_culturel/locale/fr/LC_MESSAGES/django.po b/src/agenda_culturel/locale/fr/LC_MESSAGES/django.po index 5ff8561..5eff2a0 100644 --- a/src/agenda_culturel/locale/fr/LC_MESSAGES/django.po +++ b/src/agenda_culturel/locale/fr/LC_MESSAGES/django.po @@ -2,13 +2,13 @@ # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER # This file is distributed under the same license as the PACKAGE package. # Jean-Marie Favreau , 2023. -# +# #, fuzzy msgid "" msgstr "" "Project-Id-Version: agenda_culturel\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-10-16 23:42+0200\n" +"POT-Creation-Date: 2024-10-17 23:13+0200\n" "PO-Revision-Date: 2023-10-29 14:16+0000\n" "Last-Translator: Jean-Marie Favreau \n" "Language-Team: Jean-Marie Favreau \n" @@ -90,9 +90,9 @@ msgstr "Après-midi" msgid "Evening" msgstr "Soir" -#: agenda_culturel/forms.py:44 agenda_culturel/models.py:170 -#: agenda_culturel/models.py:354 agenda_culturel/models.py:1367 -#: agenda_culturel/models.py:1467 +#: agenda_culturel/forms.py:44 agenda_culturel/models.py:171 +#: agenda_culturel/models.py:355 agenda_culturel/models.py:1376 +#: agenda_culturel/models.py:1478 msgid "Category" msgstr "Catégorie" @@ -117,8 +117,8 @@ msgstr "JSON dans le format attendu pour l'import" msgid "Apply category {} to the event {}" msgstr "Appliquer la catégorie {} à l'événement {}" -#: agenda_culturel/forms.py:422 agenda_culturel/models.py:278 -#: agenda_culturel/models.py:1519 +#: agenda_culturel/forms.py:422 agenda_culturel/models.py:279 +#: agenda_culturel/models.py:1530 msgid "Place" msgstr "Lieu" @@ -136,131 +136,131 @@ msgstr "" "Lors de l'enregistrement, utiliser des alias pour détecter tous les " "événements correspondants dont la place est manquante." -#: agenda_culturel/models.py:48 agenda_culturel/models.py:93 -#: agenda_culturel/models.py:240 agenda_culturel/models.py:257 -#: agenda_culturel/models.py:1240 agenda_culturel/models.py:1313 +#: agenda_culturel/models.py:49 agenda_culturel/models.py:94 +#: agenda_culturel/models.py:241 agenda_culturel/models.py:258 +#: agenda_culturel/models.py:1249 agenda_culturel/models.py:1322 msgid "Name" msgstr "Nom" -#: agenda_culturel/models.py:49 agenda_culturel/models.py:93 +#: agenda_culturel/models.py:50 agenda_culturel/models.py:94 msgid "Category name" msgstr "Nom de la catégorie" -#: agenda_culturel/models.py:54 +#: agenda_culturel/models.py:55 msgid "Content" msgstr "Contenu" -#: agenda_culturel/models.py:54 +#: agenda_culturel/models.py:55 msgid "Text as shown to the visitors" msgstr "Texte tel que présenté aux visiteureuses" -#: agenda_culturel/models.py:58 +#: agenda_culturel/models.py:59 msgid "URL path" msgstr "Chemin URL" -#: agenda_culturel/models.py:59 +#: agenda_culturel/models.py:60 msgid "URL path where the content is included." msgstr "Chemin URL où le contenu est présent." -#: agenda_culturel/models.py:63 +#: agenda_culturel/models.py:64 msgid "Static content" msgstr "Contenu statique" -#: agenda_culturel/models.py:64 +#: agenda_culturel/models.py:65 msgid "Static contents" msgstr "Contenus statiques" -#: agenda_culturel/models.py:96 +#: agenda_culturel/models.py:97 msgid "Alternative Name" msgstr "Nom alternatif" -#: agenda_culturel/models.py:97 +#: agenda_culturel/models.py:98 msgid "Alternative name used with a time period" msgstr "Nom alternatif utilisé avec une période de temps" -#: agenda_culturel/models.py:101 +#: agenda_culturel/models.py:102 msgid "Short name" msgstr "Nom court" -#: agenda_culturel/models.py:102 +#: agenda_culturel/models.py:103 msgid "Short name of the category" msgstr "Nom court de la catégorie" -#: agenda_culturel/models.py:106 +#: agenda_culturel/models.py:107 msgid "Color" msgstr "Couleur" -#: agenda_culturel/models.py:107 +#: agenda_culturel/models.py:108 msgid "Color used as background for the category" msgstr "Couleur utilisée comme fond de la catégorie" -#: agenda_culturel/models.py:113 +#: agenda_culturel/models.py:114 msgid "Pictogram" msgstr "Pictogramme" -#: agenda_culturel/models.py:114 +#: agenda_culturel/models.py:115 #, fuzzy #| msgid "Short name of the category" msgid "Pictogram of the category (svg format)" msgstr "Pictogramme de la catégorie (format svg)" -#: agenda_culturel/models.py:121 +#: agenda_culturel/models.py:122 msgid "Position for ordering categories" msgstr "Position pour ordonner les catégories" -#: agenda_culturel/models.py:171 +#: agenda_culturel/models.py:172 msgid "Categories" msgstr "Catégories" -#: agenda_culturel/models.py:176 agenda_culturel/models.py:177 +#: agenda_culturel/models.py:177 agenda_culturel/models.py:178 msgid "Duplicated events" msgstr "Événements dupliqués" -#: agenda_culturel/models.py:240 +#: agenda_culturel/models.py:241 msgid "Name of the location" msgstr "Nom de la position" -#: agenda_culturel/models.py:243 +#: agenda_culturel/models.py:244 msgid "Main" msgstr "Principale" -#: agenda_culturel/models.py:244 +#: agenda_culturel/models.py:245 msgid "This location is one of the main locations (shown first)." msgstr "Cette position est une position principale (affichée en premier)." -#: agenda_culturel/models.py:249 +#: agenda_culturel/models.py:250 msgid "Reference location" msgstr "Position de référence" -#: agenda_culturel/models.py:250 +#: agenda_culturel/models.py:251 msgid "Reference locations" msgstr "Positions de référence" -#: agenda_culturel/models.py:257 +#: agenda_culturel/models.py:258 msgid "Name of the place" msgstr "Nom du lieu" -#: agenda_culturel/models.py:259 +#: agenda_culturel/models.py:260 msgid "Address" msgstr "Adresse" -#: agenda_culturel/models.py:260 +#: agenda_culturel/models.py:261 msgid "Address of this place (without city name)" msgstr "Adresse de ce lieu (sans le nom de la ville)" -#: agenda_culturel/models.py:264 +#: agenda_culturel/models.py:265 msgid "City" msgstr "Ville" -#: agenda_culturel/models.py:264 +#: agenda_culturel/models.py:265 msgid "City name" msgstr "Nom de la ville" -#: agenda_culturel/models.py:269 +#: agenda_culturel/models.py:270 msgid "Alternative names" msgstr "Noms alternatifs" -#: agenda_culturel/models.py:271 +#: agenda_culturel/models.py:272 msgid "" "Alternative names or addresses used to match a place with the free-form " "location of an event." @@ -268,77 +268,77 @@ msgstr "" "Noms et adresses alternatives qui seront utilisées pour associer une adresse " "avec la localisation en forme libre d'un événement" -#: agenda_culturel/models.py:279 +#: agenda_culturel/models.py:280 msgid "Places" msgstr "Lieux" -#: agenda_culturel/models.py:332 agenda_culturel/models.py:1354 +#: agenda_culturel/models.py:333 agenda_culturel/models.py:1363 msgid "Published" msgstr "Publié" -#: agenda_culturel/models.py:333 +#: agenda_culturel/models.py:334 msgid "Draft" msgstr "Brouillon" -#: agenda_culturel/models.py:334 +#: agenda_culturel/models.py:335 msgid "Trash" msgstr "Corbeille" -#: agenda_culturel/models.py:345 +#: agenda_culturel/models.py:346 msgid "Title" msgstr "Titre" -#: agenda_culturel/models.py:345 +#: agenda_culturel/models.py:346 msgid "Short title" msgstr "Titre court" -#: agenda_culturel/models.py:349 agenda_culturel/models.py:1435 +#: agenda_culturel/models.py:350 agenda_culturel/models.py:1446 msgid "Status" msgstr "Status" -#: agenda_culturel/models.py:355 +#: agenda_culturel/models.py:356 msgid "Category of the event" msgstr "Catégorie de l'événement" -#: agenda_culturel/models.py:362 +#: agenda_culturel/models.py:363 msgid "Day of the event" msgstr "Date de l'événement" -#: agenda_culturel/models.py:365 agenda_culturel/models.py:366 +#: agenda_culturel/models.py:366 agenda_culturel/models.py:367 msgid "Starting time" msgstr "Heure de début" -#: agenda_culturel/models.py:372 +#: agenda_culturel/models.py:373 msgid "End day of the event" msgstr "Fin de l'événement" -#: agenda_culturel/models.py:374 +#: agenda_culturel/models.py:375 msgid "End day of the event, only required if different from the start day." msgstr "" "Date de fin de l'événement, uniquement nécessaire s'il est différent du " "premier jour de l'événement" -#: agenda_culturel/models.py:380 +#: agenda_culturel/models.py:381 msgid "Final time" msgstr "Heure de fin" -#: agenda_culturel/models.py:384 +#: agenda_culturel/models.py:385 msgid "Recurrence" msgstr "Récurrence" -#: agenda_culturel/models.py:389 agenda_culturel/models.py:1359 +#: agenda_culturel/models.py:390 agenda_culturel/models.py:1368 msgid "Location" msgstr "Localisation" -#: agenda_culturel/models.py:390 +#: agenda_culturel/models.py:391 msgid "Address of the event" msgstr "Adresse de l'événement" -#: agenda_culturel/models.py:396 +#: agenda_culturel/models.py:397 msgid "Location (free form)" msgstr "Localisation (forme libre)" -#: agenda_culturel/models.py:398 +#: agenda_culturel/models.py:399 msgid "" "Address of the event in case its not available in the already known places " "(free form)" @@ -346,213 +346,213 @@ msgstr "" "Addresse d'un événement si elle n'est pas déjà présente dans la liste des " "lieux disponible (forme libre)" -#: agenda_culturel/models.py:407 +#: agenda_culturel/models.py:408 msgid "Description" msgstr "Description" -#: agenda_culturel/models.py:408 +#: agenda_culturel/models.py:409 msgid "General description of the event" msgstr "Description générale de l'événement" -#: agenda_culturel/models.py:414 +#: agenda_culturel/models.py:415 msgid "Illustration (local image)" msgstr "Illustration (image locale)" -#: agenda_culturel/models.py:415 +#: agenda_culturel/models.py:416 msgid "Illustration image stored in the agenda server" msgstr "Image d'illustration stockée sur le serveur de l'agenda" -#: agenda_culturel/models.py:422 +#: agenda_culturel/models.py:423 msgid "Illustration" msgstr "Illustration" -#: agenda_culturel/models.py:423 +#: agenda_culturel/models.py:424 msgid "URL of the illustration image" msgstr "URL de l'image illustrative" -#: agenda_culturel/models.py:429 +#: agenda_culturel/models.py:430 msgid "Illustration description" msgstr "Description de l'illustration" -#: agenda_culturel/models.py:430 +#: agenda_culturel/models.py:431 msgid "Alternative text used by screen readers for the image" msgstr "Texte alternatif utiliser par les lecteurs d'écrans pour l'image" -#: agenda_culturel/models.py:438 +#: agenda_culturel/models.py:439 msgid "Importation source" msgstr "Source d'importation" -#: agenda_culturel/models.py:439 +#: agenda_culturel/models.py:440 msgid "Importation source used to detect removed entries." msgstr "Source d'importation utilisée pour détecter les éléments supprimés/" -#: agenda_culturel/models.py:445 +#: agenda_culturel/models.py:446 msgid "UUIDs" msgstr "UUIDs" -#: agenda_culturel/models.py:446 +#: agenda_culturel/models.py:447 msgid "UUIDs from import to detect duplicated entries." msgstr "UUIDs utilisés pendant l'import pour détecter les entrées dupliquées" -#: agenda_culturel/models.py:452 +#: agenda_culturel/models.py:453 msgid "URLs" msgstr "URLs" -#: agenda_culturel/models.py:453 +#: agenda_culturel/models.py:454 msgid "List of all the urls where this event can be found." msgstr "Liste de toutes les urls où l'événement peut être trouvé." -#: agenda_culturel/models.py:460 +#: agenda_culturel/models.py:461 msgid "Tags" msgstr "Étiquettes" -#: agenda_culturel/models.py:461 +#: agenda_culturel/models.py:462 msgid "A list of tags that describe the event." msgstr "Une liste d'étiquettes décrivant l'événement" -#: agenda_culturel/models.py:468 +#: agenda_culturel/models.py:469 msgid "Possibly duplicated" msgstr "Possibles doublons" -#: agenda_culturel/models.py:517 +#: agenda_culturel/models.py:518 msgid "Event" msgstr "Événement" -#: agenda_culturel/models.py:518 +#: agenda_culturel/models.py:519 msgid "Events" msgstr "Événements" -#: agenda_culturel/models.py:1231 +#: agenda_culturel/models.py:1240 msgid "Contact message" msgstr "Message de contact" -#: agenda_culturel/models.py:1232 +#: agenda_culturel/models.py:1241 msgid "Contact messages" msgstr "Messages de contact" -#: agenda_culturel/models.py:1235 +#: agenda_culturel/models.py:1244 msgid "Subject" msgstr "Sujet" -#: agenda_culturel/models.py:1236 +#: agenda_culturel/models.py:1245 msgid "The subject of your message" msgstr "Sujet de votre message" -#: agenda_culturel/models.py:1241 +#: agenda_culturel/models.py:1250 msgid "Your name" msgstr "Votre nom" -#: agenda_culturel/models.py:1247 +#: agenda_culturel/models.py:1256 msgid "Email address" msgstr "Adresse email" -#: agenda_culturel/models.py:1248 +#: agenda_culturel/models.py:1257 msgid "Your email address" msgstr "Votre adresse email" -#: agenda_culturel/models.py:1253 +#: agenda_culturel/models.py:1262 msgid "Message" msgstr "Message" -#: agenda_culturel/models.py:1253 +#: agenda_culturel/models.py:1262 msgid "Your message" msgstr "Votre message" -#: agenda_culturel/models.py:1258 agenda_culturel/views.py:916 +#: agenda_culturel/models.py:1267 agenda_culturel/views.py:928 msgid "Spam" msgstr "Spam" -#: agenda_culturel/models.py:1259 +#: agenda_culturel/models.py:1268 msgid "This message is a spam." msgstr "Ce message est un spam." -#: agenda_culturel/models.py:1264 agenda_culturel/views.py:911 +#: agenda_culturel/models.py:1273 agenda_culturel/views.py:923 msgid "Closed" msgstr "Fermé" -#: agenda_culturel/models.py:1266 +#: agenda_culturel/models.py:1275 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:1271 +#: agenda_culturel/models.py:1280 msgid "Comments" msgstr "Commentaires" -#: agenda_culturel/models.py:1272 +#: agenda_culturel/models.py:1281 msgid "Comments on the message from the moderation team" msgstr "Commentaires sur ce message par l'équipe de modération" -#: agenda_culturel/models.py:1284 agenda_culturel/models.py:1415 +#: agenda_culturel/models.py:1293 agenda_culturel/models.py:1426 msgid "Recurrent import" msgstr "Import récurrent" -#: agenda_culturel/models.py:1285 +#: agenda_culturel/models.py:1294 msgid "Recurrent imports" msgstr "Imports récurrents" -#: agenda_culturel/models.py:1289 +#: agenda_culturel/models.py:1298 msgid "ical" msgstr "ical" -#: agenda_culturel/models.py:1290 +#: agenda_culturel/models.py:1299 msgid "ical no busy" msgstr "ical sans busy" -#: agenda_culturel/models.py:1291 +#: agenda_culturel/models.py:1300 msgid "ical no VC" msgstr "ical sans VC" -#: agenda_culturel/models.py:1292 +#: agenda_culturel/models.py:1301 msgid "lacoope.org" msgstr "lacoope.org" -#: agenda_culturel/models.py:1293 +#: agenda_culturel/models.py:1302 msgid "la comédie" msgstr "la comédie" -#: agenda_culturel/models.py:1294 +#: agenda_culturel/models.py:1303 msgid "le fotomat" msgstr "le fotomat" -#: agenda_culturel/models.py:1295 +#: agenda_culturel/models.py:1304 #, fuzzy #| msgid "la puce à loreille" msgid "la puce à l'oreille" msgstr "la puce à loreille" -#: agenda_culturel/models.py:1296 +#: agenda_culturel/models.py:1305 msgid "Plugin wordpress MEC" msgstr "Plugin wordpress MEC" -#: agenda_culturel/models.py:1297 +#: agenda_culturel/models.py:1306 msgid "Événements d'une page FB" msgstr "Événements d'une page FB" -#: agenda_culturel/models.py:1298 +#: agenda_culturel/models.py:1307 msgid "la cour des 3 coquins" msgstr "la cour des 3 coquins" -#: agenda_culturel/models.py:1301 +#: agenda_culturel/models.py:1310 msgid "simple" msgstr "simple" -#: agenda_culturel/models.py:1302 +#: agenda_culturel/models.py:1311 msgid "Headless Chromium" msgstr "chromium sans interface" -#: agenda_culturel/models.py:1303 +#: agenda_culturel/models.py:1312 msgid "Headless Chromium (pause)" msgstr "chromium sans interface (pause)" -#: agenda_culturel/models.py:1308 +#: agenda_culturel/models.py:1317 msgid "daily" msgstr "chaque jour" -#: agenda_culturel/models.py:1310 +#: agenda_culturel/models.py:1319 msgid "weekly" msgstr "chaque semaine" -#: agenda_culturel/models.py:1315 +#: agenda_culturel/models.py:1324 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." @@ -560,135 +560,135 @@ 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:1322 +#: agenda_culturel/models.py:1331 msgid "Processor" msgstr "Processeur" -#: agenda_culturel/models.py:1325 +#: agenda_culturel/models.py:1334 msgid "Downloader" msgstr "Téléchargeur" -#: agenda_culturel/models.py:1332 +#: agenda_culturel/models.py:1341 msgid "Import recurrence" msgstr "Récurrence d'import" -#: agenda_culturel/models.py:1339 +#: agenda_culturel/models.py:1348 msgid "Source" msgstr "Source" -#: agenda_culturel/models.py:1340 +#: agenda_culturel/models.py:1349 msgid "URL of the source document" msgstr "URL du document source" -#: agenda_culturel/models.py:1344 +#: agenda_culturel/models.py:1353 msgid "Browsable url" msgstr "URL navigable" -#: agenda_culturel/models.py:1346 +#: agenda_culturel/models.py:1355 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:1355 +#: agenda_culturel/models.py:1364 msgid "Status of each imported event (published or draft)" msgstr "Status de chaque événement importé (publié ou brouillon)" -#: agenda_culturel/models.py:1360 +#: agenda_culturel/models.py:1369 msgid "Address for each imported event" msgstr "Adresse de chaque événement importé" -#: agenda_culturel/models.py:1368 +#: agenda_culturel/models.py:1377 msgid "Category of each imported event" msgstr "Catégorie de chaque événement importé" -#: agenda_culturel/models.py:1374 +#: agenda_culturel/models.py:1385 msgid "Tags for each imported event" msgstr "Étiquettes de chaque événement importé" -#: agenda_culturel/models.py:1375 +#: agenda_culturel/models.py:1386 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:1401 +#: agenda_culturel/models.py:1412 msgid "Running" msgstr "En cours" -#: agenda_culturel/models.py:1402 +#: agenda_culturel/models.py:1413 msgid "Canceled" msgstr "Annulé" -#: agenda_culturel/models.py:1403 +#: agenda_culturel/models.py:1414 msgid "Success" msgstr "Succès" -#: agenda_culturel/models.py:1404 +#: agenda_culturel/models.py:1415 msgid "Failed" msgstr "Erreur" -#: agenda_culturel/models.py:1407 +#: agenda_culturel/models.py:1418 msgid "Batch importation" msgstr "Importation par lot" -#: agenda_culturel/models.py:1408 +#: agenda_culturel/models.py:1419 msgid "Batch importations" msgstr "Importations par lot" -#: agenda_culturel/models.py:1416 +#: agenda_culturel/models.py:1427 msgid "Reference to the recurrent import processing" msgstr "Référence du processus d'import récurrent" -#: agenda_culturel/models.py:1424 +#: agenda_culturel/models.py:1435 msgid "URL (if not recurrent import)" msgstr "URL (si pas d'import récurrent)" -#: agenda_culturel/models.py:1426 +#: agenda_culturel/models.py:1437 msgid "Source URL if no RecurrentImport is associated." msgstr "URL source si aucun import récurrent n'est associé" -#: agenda_culturel/models.py:1439 +#: agenda_culturel/models.py:1450 msgid "Error message" msgstr "Votre message" -#: agenda_culturel/models.py:1443 +#: agenda_culturel/models.py:1454 msgid "Number of collected events" msgstr "Nombre d'événements collectés" -#: agenda_culturel/models.py:1446 +#: agenda_culturel/models.py:1457 msgid "Number of imported events" msgstr "Nombre d'événements importés" -#: agenda_culturel/models.py:1449 +#: agenda_culturel/models.py:1460 msgid "Number of updated events" msgstr "Nombre d'événements mis à jour" -#: agenda_culturel/models.py:1452 +#: agenda_culturel/models.py:1463 msgid "Number of removed events" msgstr "Nombre d'événements supprimés" -#: agenda_culturel/models.py:1460 +#: agenda_culturel/models.py:1471 msgid "Weight" msgstr "Poids" -#: agenda_culturel/models.py:1461 +#: agenda_culturel/models.py:1472 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:1468 +#: agenda_culturel/models.py:1479 msgid "Category applied to the event" msgstr "Catégorie appliquée à l'événement" -#: agenda_culturel/models.py:1473 +#: agenda_culturel/models.py:1484 msgid "Contained in the title" msgstr "Contenu dans le titre" -#: agenda_culturel/models.py:1474 +#: agenda_culturel/models.py:1485 msgid "Text contained in the event title" msgstr "Texte contenu dans le titre de l'événement" -#: agenda_culturel/models.py:1480 +#: agenda_culturel/models.py:1491 msgid "Exact title extract" msgstr "Extrait exact du titre" -#: agenda_culturel/models.py:1482 +#: agenda_culturel/models.py:1493 msgid "" "If checked, the extract will be searched for in the title using the exact " "form (capitals, accents)." @@ -696,19 +696,19 @@ msgstr "" "Si coché, l'extrait sera recherché dans le titre en utilisant la forme " "exacte (majuscules, accents)" -#: agenda_culturel/models.py:1488 +#: agenda_culturel/models.py:1499 msgid "Contained in the description" msgstr "Contenu dans la description" -#: agenda_culturel/models.py:1489 +#: agenda_culturel/models.py:1500 msgid "Text contained in the description" msgstr "Texte contenu dans la description" -#: agenda_culturel/models.py:1495 +#: agenda_culturel/models.py:1506 msgid "Exact description extract" msgstr "Extrait exact de description" -#: agenda_culturel/models.py:1497 +#: agenda_culturel/models.py:1508 msgid "" "If checked, the extract will be searched for in the description using the " "exact form (capitals, accents)." @@ -716,19 +716,19 @@ msgstr "" "Si coché, l'extrait sera recherché dans la description en utilisant la forme " "exacte (majuscules, accents)" -#: agenda_culturel/models.py:1503 +#: agenda_culturel/models.py:1514 msgid "Contained in the location" msgstr "Contenu dans la localisation" -#: agenda_culturel/models.py:1504 +#: agenda_culturel/models.py:1515 msgid "Text contained in the event location" msgstr "Texte contenu dans la localisation de l'événement" -#: agenda_culturel/models.py:1510 +#: agenda_culturel/models.py:1521 msgid "Exact location extract" msgstr "Extrait exact de localisation" -#: agenda_culturel/models.py:1512 +#: agenda_culturel/models.py:1523 msgid "" "If checked, the extract will be searched for in the location using the exact " "form (capitals, accents)." @@ -736,56 +736,56 @@ msgstr "" "Si coché, l'extrait sera recherché dans la localisation en utilisant la " "forme exacte (majuscules, accents)" -#: agenda_culturel/models.py:1520 +#: agenda_culturel/models.py:1531 msgid "Location from place" msgstr "Localisation depuis le lieu" -#: agenda_culturel/models.py:1527 +#: agenda_culturel/models.py:1538 msgid "Categorisation rule" msgstr "Règle de catégorisation" -#: agenda_culturel/models.py:1528 +#: agenda_culturel/models.py:1539 msgid "Categorisation rules" msgstr "Règles de catégorisation" -#: agenda_culturel/models.py:1595 agenda_culturel/models.py:1627 +#: agenda_culturel/models.py:1606 agenda_culturel/models.py:1638 msgid "Question" msgstr "Question" -#: agenda_culturel/models.py:1596 agenda_culturel/models.py:1634 +#: agenda_culturel/models.py:1607 agenda_culturel/models.py:1645 msgid "Text that will be shown to moderators" msgstr "Text tel que présenté aux modérateurices" -#: agenda_culturel/models.py:1602 +#: agenda_culturel/models.py:1613 msgid "Moderation question" msgstr "Question de modération" -#: agenda_culturel/models.py:1603 +#: agenda_culturel/models.py:1614 msgid "Moderation questions" msgstr "Questions de modération" -#: agenda_culturel/models.py:1628 +#: agenda_culturel/models.py:1639 msgid "Associated question from moderation" msgstr "Question associée pour la modération" -#: agenda_culturel/models.py:1633 +#: agenda_culturel/models.py:1644 msgid "Answer" msgstr "Réponse" -#: agenda_culturel/models.py:1640 +#: agenda_culturel/models.py:1651 msgid "Adds tags" msgstr "Ajoute les étiquettes" -#: agenda_culturel/models.py:1641 +#: agenda_culturel/models.py:1652 msgid "A list of tags that will be added if you choose this answer." msgstr "" "Une liste d'étiquettes qui seront ajoutées si vous choisissez cette réponse." -#: agenda_culturel/models.py:1647 +#: agenda_culturel/models.py:1658 msgid "Removes tags" msgstr "Retire les étiquettes" -#: agenda_culturel/models.py:1648 +#: agenda_culturel/models.py:1659 msgid "A list of tags that will be removed if you choose this answer." msgstr "" "Une liste d'étiquettes qui seront retirées si vous choisissez cette réponse." @@ -818,11 +818,23 @@ msgstr "Pas de fichier sélectionné." msgid "The static content has been successfully updated." msgstr "Le contenu statique a été modifié avec succès." -#: agenda_culturel/views.py:542 agenda_culturel/views.py:590 +#: agenda_culturel/views.py:541 +msgid "" +"The event cannot be updated because the import process is not available for " +"the referenced sources." +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:544 +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:554 agenda_culturel/views.py:602 msgid "The event has been successfully modified." msgstr "L'événement a été modifié avec succès." -#: agenda_culturel/views.py:547 +#: agenda_culturel/views.py:559 msgid "" "Please note that this event has not been modified since it was last updated " "by import. If you modify any information from this import, the event will be " @@ -834,15 +846,15 @@ msgstr "" "l'événement sera désynchronisé d'avec la source, et nécessitera une fusion à " "chaque import automatique futurs." -#: agenda_culturel/views.py:559 +#: agenda_culturel/views.py:571 msgid "The event has been successfully deleted." msgstr "L'événement a été supprimé avec succès" -#: agenda_culturel/views.py:615 +#: agenda_culturel/views.py:627 msgid "The status has been successfully modified." msgstr "Le status a été modifié avec succès." -#: agenda_culturel/views.py:637 agenda_culturel/views.py:657 +#: agenda_culturel/views.py:649 agenda_culturel/views.py:669 msgid "" "The event has been submitted and will be published as soon as it has been " "validated by the moderation team." @@ -850,91 +862,91 @@ 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:651 +#: agenda_culturel/views.py:663 msgid "The event is saved." msgstr "L'événement est enregistré." -#: agenda_culturel/views.py:743 agenda_culturel/views.py:795 +#: agenda_culturel/views.py:755 agenda_culturel/views.py:807 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:748 agenda_culturel/views.py:801 +#: agenda_culturel/views.py:760 agenda_culturel/views.py:813 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:758 +#: agenda_culturel/views.py:770 msgid "Integrating {} url(s) into our import process." msgstr "Intégration de {} url(s) dans notre processus d'import." -#: agenda_culturel/views.py:808 +#: agenda_culturel/views.py:820 msgid "Integrating {} into our import process." msgstr "Intégration de {} dans notre processus d'import." -#: agenda_culturel/views.py:871 +#: agenda_culturel/views.py:883 msgid "Your message has been sent successfully." msgstr "Votre message a été envoyé avec succès." -#: agenda_culturel/views.py:881 +#: agenda_culturel/views.py:893 msgid "The contact message has been successfully deleted." msgstr "Le message de contact a été supprimé avec succès." -#: agenda_culturel/views.py:895 +#: agenda_culturel/views.py:907 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:911 +#: agenda_culturel/views.py:923 msgid "Open" msgstr "Ouvert" -#: agenda_culturel/views.py:916 +#: agenda_culturel/views.py:928 msgid "Non spam" msgstr "Non spam" -#: agenda_culturel/views.py:979 +#: agenda_culturel/views.py:991 #, fuzzy #| msgid "The event has been successfully deleted." msgid "Spam has been successfully deleted." msgstr "L'événement a été supprimé avec succès" -#: agenda_culturel/views.py:996 +#: agenda_culturel/views.py:1008 msgid "Search" msgstr "Rechercher" -#: agenda_culturel/views.py:1182 +#: agenda_culturel/views.py:1194 msgid "The import has been run successfully." msgstr "L'import a été lancé avec succès" -#: agenda_culturel/views.py:1201 +#: agenda_culturel/views.py:1213 msgid "The import has been canceled." msgstr "L'import a été annulé" -#: agenda_culturel/views.py:1275 +#: agenda_culturel/views.py:1287 msgid "The recurrent import has been successfully modified." msgstr "L'import récurrent a été modifié avec succès." -#: agenda_culturel/views.py:1284 +#: agenda_culturel/views.py:1296 msgid "The recurrent import has been successfully deleted." msgstr "L'import récurrent a été supprimé avec succès" -#: agenda_culturel/views.py:1324 +#: agenda_culturel/views.py:1336 msgid "The import has been launched." msgstr "L'import a été lancé" -#: agenda_culturel/views.py:1346 +#: agenda_culturel/views.py:1358 msgid "Imports has been launched." msgstr "Les imports ont été lancés" -#: agenda_culturel/views.py:1431 +#: agenda_culturel/views.py:1443 msgid "The merge has been successfully completed." msgstr "La fusion a été réalisée avec succès." -#: agenda_culturel/views.py:1465 +#: agenda_culturel/views.py:1477 msgid "Events have been marked as unduplicated." msgstr "Les événements ont été marqués comme non dupliqués." -#: agenda_culturel/views.py:1487 +#: agenda_culturel/views.py:1499 msgid "" "The selected event has been retained, while the other has been moved to the " "recycle bin." @@ -942,7 +954,7 @@ msgstr "" "L'événement sélectionné a été conservé, l'autre a été déplacé dans la " "corbeille." -#: agenda_culturel/views.py:1494 +#: agenda_culturel/views.py:1506 msgid "" "The selected event has been retained, while the others have been moved to " "the recycle bin." @@ -950,19 +962,19 @@ msgstr "" "L'événement sélectionné a été conservé, les autres ont été déplacés dans la " "corbeille." -#: agenda_culturel/views.py:1505 +#: agenda_culturel/views.py:1517 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:1538 +#: agenda_culturel/views.py:1550 msgid "Cleaning up duplicates: {} item(s) removed." msgstr "Nettoyage des dupliqués: {} élément(s) supprimés." -#: agenda_culturel/views.py:1582 +#: agenda_culturel/views.py:1594 msgid "The event was successfully duplicated." msgstr "L'événement a été marqué dupliqué avec succès." -#: agenda_culturel/views.py:1590 +#: agenda_culturel/views.py:1602 msgid "" "The event has been successfully flagged as a duplicate. The moderation team " "will deal with your suggestion shortly." @@ -970,63 +982,63 @@ 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:1643 +#: agenda_culturel/views.py:1655 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:1652 +#: agenda_culturel/views.py:1664 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:1674 agenda_culturel/views.py:1721 +#: agenda_culturel/views.py:1686 agenda_culturel/views.py:1733 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:1681 agenda_culturel/views.py:1728 +#: agenda_culturel/views.py:1693 agenda_culturel/views.py:1740 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:1688 agenda_culturel/views.py:1735 +#: agenda_culturel/views.py:1700 agenda_culturel/views.py:1747 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:1775 +#: agenda_culturel/views.py:1787 msgid "The moderation question has been created with success." msgstr "La question de modération a été créée avec succès." -#: agenda_culturel/views.py:1901 agenda_culturel/views.py:1963 -#: agenda_culturel/views.py:2001 +#: agenda_culturel/views.py:1913 agenda_culturel/views.py:1975 +#: agenda_culturel/views.py:2013 msgid "{} events have been updated." msgstr "{} événements ont été mis à jour." -#: agenda_culturel/views.py:1904 agenda_culturel/views.py:1965 -#: agenda_culturel/views.py:2004 +#: agenda_culturel/views.py:1916 agenda_culturel/views.py:1977 +#: agenda_culturel/views.py:2016 msgid "1 event has been updated." msgstr "1 événement a été mis à jour" -#: agenda_culturel/views.py:1906 agenda_culturel/views.py:1967 -#: agenda_culturel/views.py:2006 +#: agenda_culturel/views.py:1918 agenda_culturel/views.py:1979 +#: agenda_culturel/views.py:2018 msgid "No events have been modified." msgstr "Aucun événement n'a été modifié." -#: agenda_culturel/views.py:1915 +#: agenda_culturel/views.py:1927 msgid "The place has been successfully updated." msgstr "Le lieu a été modifié avec succès." -#: agenda_culturel/views.py:1924 +#: agenda_culturel/views.py:1936 msgid "The place has been successfully created." msgstr "Le lieu a été créé avec succès." -#: agenda_culturel/views.py:1989 +#: agenda_culturel/views.py:2001 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:1993 +#: agenda_culturel/views.py:2005 msgid "A new alias has been added to the selected place." msgstr "Un nouvel alias a été créé pour le lieu sélectionné." diff --git a/src/agenda_culturel/models.py b/src/agenda_culturel/models.py index b062deb..424e794 100644 --- a/src/agenda_culturel/models.py +++ b/src/agenda_culturel/models.py @@ -18,6 +18,7 @@ import recurrence import copy import unicodedata from collections import defaultdict +from .import_tasks.extractor_facebook import FacebookEventExtractor from django.template.defaultfilters import date as _date from datetime import time, timedelta, date @@ -847,6 +848,16 @@ class Event(models.Model): if self.uuids is None or len(self.uuids) == 0 else Event.objects.filter(uuids__contains=self.uuids) ) + + def get_updateable_uuid(self): + if self.uuids and len(self.uuids) > 0: + for s in self.uuids: + if FacebookEventExtractor.is_known_url(s): + return s + return None + + def is_updateable(self): + return not self.get_updateable_uuid() is None def split_uuid(uuid): els = uuid.split(":") diff --git a/src/agenda_culturel/templates/agenda_culturel/edit-buttons-inc.html b/src/agenda_culturel/templates/agenda_culturel/edit-buttons-inc.html index 78152ec..3b30cb2 100644 --- a/src/agenda_culturel/templates/agenda_culturel/edit-buttons-inc.html +++ b/src/agenda_culturel/templates/agenda_culturel/edit-buttons-inc.html @@ -1,5 +1,10 @@ {% load utils_extra %} + +{% if event.is_updateable %} +Réimporter {% picto_from_name "download-cloud" %} +{% endif %} + modérer {% picto_from_name "edit" %} modifier {% picto_from_name "edit-3" %} @@ -20,3 +25,4 @@ {% if event.status == "trash" %} supprimer définitivement {% picto_from_name "x-circle" %} {% endif %} + diff --git a/src/agenda_culturel/urls.py b/src/agenda_culturel/urls.py index 6824c23..1947586 100644 --- a/src/agenda_culturel/urls.py +++ b/src/agenda_culturel/urls.py @@ -27,6 +27,7 @@ urlpatterns = [ name="view_event", ), path("event//edit", EventUpdateView.as_view(), name="edit_event"), + path("event//update-from-source", update_from_source, name="update_from_source"), path( "event//change-status/", change_status_event, diff --git a/src/agenda_culturel/views.py b/src/agenda_culturel/views.py index 407680f..d13b2c7 100644 --- a/src/agenda_culturel/views.py +++ b/src/agenda_culturel/views.py @@ -533,6 +533,18 @@ class StaticContentUpdateView( success_message = _("The static content has been successfully updated.") +def update_from_source(request, pk): + event = get_object_or_404(Event, pk=pk) + + url = event.get_updateable_uuid() + if url is None: + messages.warning(request, _("The event cannot be updated because the import process is not available for the referenced sources.")) + else: + import_events_from_url.delay(url, None, True) + messages.success(request, _("The event update has been queued and will be completed shortly.")) + + return HttpResponseRedirect(event.get_absolute_url()) + class EventUpdateView( SuccessMessageMixin, PermissionRequiredMixin, LoginRequiredMixin, UpdateView ):