On peut forcer la localisation

Fix #248
This commit is contained in:
Jean-Marie Favreau 2024-12-22 15:32:21 +01:00
parent d844fb7ccf
commit 933e73de5c
4 changed files with 62 additions and 43 deletions

View File

@ -176,6 +176,11 @@ def run_recurrent_import_internal(rimport, downloader, req_id):
published=published,
)
# force location if required
if rimport.forceLocation and location:
for i, e in enumerate(events['events']):
events['events'][i]["location"] = location
# convert it to json
json_events = json.dumps(events, default=str)

View File

@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: agenda_culturel\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-12-15 19:00+0100\n"
"POT-Creation-Date: 2024-12-22 15:20+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"
@ -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:1958
#: agenda_culturel/models.py:2068
#: agenda_culturel/models.py:620 agenda_culturel/models.py:1964
#: agenda_culturel/models.py:2074
msgid "Category"
msgstr "Catégorie"
@ -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:2120
#: agenda_culturel/models.py:2126
msgid "Place"
msgstr "Lieu"
@ -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:2036
#: agenda_culturel/models.py:615 agenda_culturel/models.py:2042
msgid "Status"
msgstr "Status"
@ -738,7 +738,7 @@ msgstr "Commentaires"
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:2016
#: agenda_culturel/models.py:1862 agenda_culturel/models.py:2022
msgid "Recurrent import"
msgstr "Import récurrent"
@ -858,107 +858,115 @@ msgstr "Status de chaque événement importé (publié ou brouillon)"
msgid "Address for each imported event"
msgstr "Adresse de chaque événement importé"
#: agenda_culturel/models.py:1947
msgid "Force location"
msgstr "Focer la localisation"
#: agenda_culturel/models.py:1948
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
msgid "Organiser"
msgstr "Organisateur"
#: agenda_culturel/models.py:1949
#: agenda_culturel/models.py:1955
msgid "Organiser of each imported event"
msgstr "Organisateur de chaque événement importé"
#: agenda_culturel/models.py:1959
#: agenda_culturel/models.py:1965
msgid "Category of each imported event"
msgstr "Catégorie de chaque événement importé"
#: agenda_culturel/models.py:1967
#: agenda_culturel/models.py:1973
msgid "Tags for each imported event"
msgstr "Étiquettes de chaque événement importé"
#: agenda_culturel/models.py:1968
#: agenda_culturel/models.py:1974
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:1997
#: agenda_culturel/models.py:2003
msgid "Running"
msgstr "En cours"
#: agenda_culturel/models.py:1998
#: agenda_culturel/models.py:2004
msgid "Canceled"
msgstr "Annulé"
#: agenda_culturel/models.py:1999
#: agenda_culturel/models.py:2005
msgid "Success"
msgstr "Succès"
#: agenda_culturel/models.py:2000
#: agenda_culturel/models.py:2006
msgid "Failed"
msgstr "Erreur"
#: agenda_culturel/models.py:2003
#: agenda_culturel/models.py:2009
msgid "Batch importation"
msgstr "Importation par lot"
#: agenda_culturel/models.py:2004
#: agenda_culturel/models.py:2010
msgid "Batch importations"
msgstr "Importations par lot"
#: agenda_culturel/models.py:2017
#: agenda_culturel/models.py:2023
msgid "Reference to the recurrent import processing"
msgstr "Référence du processus d'import récurrent"
#: agenda_culturel/models.py:2025
#: agenda_culturel/models.py:2031
msgid "URL (if not recurrent import)"
msgstr "URL (si pas d'import récurrent)"
#: agenda_culturel/models.py:2027
#: agenda_culturel/models.py:2033
msgid "Source URL if no RecurrentImport is associated."
msgstr "URL source si aucun import récurrent n'est associé"
#: agenda_culturel/models.py:2040
#: agenda_culturel/models.py:2046
msgid "Error message"
msgstr "Votre message"
#: agenda_culturel/models.py:2044
#: agenda_culturel/models.py:2050
msgid "Number of collected events"
msgstr "Nombre d'événements collectés"
#: agenda_culturel/models.py:2047
#: agenda_culturel/models.py:2053
msgid "Number of imported events"
msgstr "Nombre d'événements importés"
#: agenda_culturel/models.py:2050
#: agenda_culturel/models.py:2056
msgid "Number of updated events"
msgstr "Nombre d'événements mis à jour"
#: agenda_culturel/models.py:2053
#: agenda_culturel/models.py:2059
msgid "Number of removed events"
msgstr "Nombre d'événements supprimés"
#: agenda_culturel/models.py:2061
#: agenda_culturel/models.py:2067
msgid "Weight"
msgstr "Poids"
#: agenda_culturel/models.py:2062
#: agenda_culturel/models.py:2068
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:2069
#: agenda_culturel/models.py:2075
msgid "Category applied to the event"
msgstr "Catégorie appliquée à l'événement"
#: agenda_culturel/models.py:2074
#: agenda_culturel/models.py:2080
msgid "Contained in the title"
msgstr "Contenu dans le titre"
#: agenda_culturel/models.py:2075
#: agenda_culturel/models.py:2081
msgid "Text contained in the event title"
msgstr "Texte contenu dans le titre de l'événement"
#: agenda_culturel/models.py:2081
#: agenda_culturel/models.py:2087
msgid "Exact title extract"
msgstr "Extrait exact du titre"
#: agenda_culturel/models.py:2083
#: agenda_culturel/models.py:2089
msgid ""
"If checked, the extract will be searched for in the title using the exact "
"form (capitals, accents)."
@ -966,19 +974,19 @@ msgstr ""
"Si coché, l'extrait sera recherché dans le titre en utilisant la forme "
"exacte (majuscules, accents)"
#: agenda_culturel/models.py:2089
#: agenda_culturel/models.py:2095
msgid "Contained in the description"
msgstr "Contenu dans la description"
#: agenda_culturel/models.py:2090
#: agenda_culturel/models.py:2096
msgid "Text contained in the description"
msgstr "Texte contenu dans la description"
#: agenda_culturel/models.py:2096
#: agenda_culturel/models.py:2102
msgid "Exact description extract"
msgstr "Extrait exact de description"
#: agenda_culturel/models.py:2098
#: agenda_culturel/models.py:2104
msgid ""
"If checked, the extract will be searched for in the description using the "
"exact form (capitals, accents)."
@ -986,19 +994,19 @@ msgstr ""
"Si coché, l'extrait sera recherché dans la description en utilisant la forme "
"exacte (majuscules, accents)"
#: agenda_culturel/models.py:2104
#: agenda_culturel/models.py:2110
msgid "Contained in the location"
msgstr "Contenu dans la localisation"
#: agenda_culturel/models.py:2105
#: agenda_culturel/models.py:2111
msgid "Text contained in the event location"
msgstr "Texte contenu dans la localisation de l'événement"
#: agenda_culturel/models.py:2111
#: agenda_culturel/models.py:2117
msgid "Exact location extract"
msgstr "Extrait exact de localisation"
#: agenda_culturel/models.py:2113
#: agenda_culturel/models.py:2119
msgid ""
"If checked, the extract will be searched for in the location using the exact "
"form (capitals, accents)."
@ -1006,15 +1014,15 @@ msgstr ""
"Si coché, l'extrait sera recherché dans la localisation en utilisant la "
"forme exacte (majuscules, accents)"
#: agenda_culturel/models.py:2121
#: agenda_culturel/models.py:2127
msgid "Location from place"
msgstr "Localisation depuis le lieu"
#: agenda_culturel/models.py:2130
#: agenda_culturel/models.py:2136
msgid "Categorisation rule"
msgstr "Règle de catégorisation"
#: agenda_culturel/models.py:2131
#: agenda_culturel/models.py:2137
msgid "Categorisation rules"
msgstr "Règles de catégorisation"

View File

@ -1943,6 +1943,12 @@ class RecurrentImport(models.Model):
blank=True,
)
forceLocation = models.BooleanField(
verbose_name=_("Force location"),
help_text=_("force location even if another is detected."),
default=False
)
defaultOrganiser = models.ForeignKey(
Organisation,
verbose_name=_("Organiser"),

View File

@ -40,7 +40,7 @@
<li><strong>Valeurs par défaut&nbsp;:</strong>
<ul>
<li><strong>Publié&nbsp;:</strong> {{ object.defaultPublished|yesno:"Oui,Non" }}</li>
{% if object.defaultLocation %}<li><strong>Localisation&nbsp;:</strong> {{ object.defaultLocation }}</li>{% endif %}
{% if object.defaultLocation %}<li><strong>Localisation{% if object.forceLocation %} (forcée){% endif %}&nbsp;:</strong> {{ object.defaultLocation }}</li>{% endif %}
<li><strong>Catégorie&nbsp;:</strong> {{ object.defaultCategory }}</li>
{% if object.defaultOrganiser %}<li><strong>Organisateur&nbsp;:</strong> <a href="{{ object.defaultOrganiser.get_absolute_url }}">{{ object.defaultOrganiser }}</a></li>{% endif %}
<li><strong>Étiquettes&nbsp;:</strong>