diff --git a/src/agenda_culturel/models.py b/src/agenda_culturel/models.py index 6e20ff6..be59f39 100644 --- a/src/agenda_culturel/models.py +++ b/src/agenda_culturel/models.py @@ -552,6 +552,21 @@ class Event(models.Model): else: return recurrences[0] + def get_image_url(self): + if self.local_image and hasattr(self.local_image, "url"): + try: + return self.local_image.url + except: + pass + if self.image: + return self.image + else: + return None + + def has_image_url(self): + return self.get_image_url() is not None + + # return a copy of the current object for each recurrence between first an last date (included) def get_recurrences_between(self, firstdate, lastdate): if not self.has_recurrences(): diff --git a/src/agenda_culturel/templates/agenda_culturel/batchimportation_form.html b/src/agenda_culturel/templates/agenda_culturel/batchimportation_form.html index d243ab1..4db2a29 100644 --- a/src/agenda_culturel/templates/agenda_culturel/batchimportation_form.html +++ b/src/agenda_culturel/templates/agenda_culturel/batchimportation_form.html @@ -1,7 +1,7 @@ {% extends "agenda_culturel/page.html" %} {% load static %} -{% block title %}Importation manuelle{% endblock %} +{% block title %}{% block og_title %}Importation manuelle{% endblock %}{% endblock %} {% block content %} diff --git a/src/agenda_culturel/templates/agenda_culturel/cancel_import_confirm.html b/src/agenda_culturel/templates/agenda_culturel/cancel_import_confirm.html index 99fea5d..c6c728e 100644 --- a/src/agenda_culturel/templates/agenda_culturel/cancel_import_confirm.html +++ b/src/agenda_culturel/templates/agenda_culturel/cancel_import_confirm.html @@ -1,6 +1,6 @@ {% extends "agenda_culturel/page.html" %} -{% block title %}Supprimer {{ object.title }}{% endblock %} +{% block title %}{% block og_title %}Supprimer {{ object.title }}{% endblock %}{% endblock %} {% block content %} diff --git a/src/agenda_culturel/templates/agenda_culturel/categorisation_rules.html b/src/agenda_culturel/templates/agenda_culturel/categorisation_rules.html index aa7436f..e0d564f 100644 --- a/src/agenda_culturel/templates/agenda_culturel/categorisation_rules.html +++ b/src/agenda_culturel/templates/agenda_culturel/categorisation_rules.html @@ -1,6 +1,6 @@ {% extends "agenda_culturel/page.html" %} -{% block title %}Règles de catégorisation{% endblock %} +{% block title %}{% block og_title %}Règles de catégorisation{% endblock %}{% endblock %} {% load utils_extra %} {% load cat_extra %} diff --git a/src/agenda_culturel/templates/agenda_culturel/categorisationrule_confirm_delete.html b/src/agenda_culturel/templates/agenda_culturel/categorisationrule_confirm_delete.html index 2eeab7b..894eb3c 100644 --- a/src/agenda_culturel/templates/agenda_culturel/categorisationrule_confirm_delete.html +++ b/src/agenda_culturel/templates/agenda_culturel/categorisationrule_confirm_delete.html @@ -1,6 +1,6 @@ {% extends "agenda_culturel/page.html" %} -{% block title %}Supprimer la règle de catégorisation {{ object.pk }}{% endblock %} +{% block title %}{% block og_title %}Supprimer la règle de catégorisation {{ object.pk }}{% endblock %}{% endblock %} {% block content %} diff --git a/src/agenda_culturel/templates/agenda_culturel/categorisationrule_form.html b/src/agenda_culturel/templates/agenda_culturel/categorisationrule_form.html index b5bb4a4..3fa14b8 100644 --- a/src/agenda_culturel/templates/agenda_culturel/categorisationrule_form.html +++ b/src/agenda_culturel/templates/agenda_culturel/categorisationrule_form.html @@ -1,7 +1,7 @@ {% extends "agenda_culturel/page.html" %} {% load static %} -{% block title %}Règle de catéorisation{% endblock %} +{% block title %}{% block og_title %}Règle de catéorisation{% endblock %}{% endblock %} {% block entete_header %} diff --git a/src/agenda_culturel/templates/agenda_culturel/categorise_events_form.html b/src/agenda_culturel/templates/agenda_culturel/categorise_events_form.html index bc2e653..c0787ce 100644 --- a/src/agenda_culturel/templates/agenda_culturel/categorise_events_form.html +++ b/src/agenda_culturel/templates/agenda_culturel/categorise_events_form.html @@ -6,7 +6,7 @@ {% load tag_extra %} -{% block title %}Appliquer les catégorisations{% endblock %} +{% block title %}{% block og_title %}Appliquer les catégorisations{% endblock %}{% endblock %} {% block entete_header %} 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 20da2a3..d784860 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,7 @@ {% extends "agenda_culturel/page.html" %} {% load static %} -{% block title %}Contact{% endblock %} +{% block title %}{% block og_title %}Contact{% endblock %}{% endblock %} {% block entete_header %} 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 833c894..72ee47e 100644 --- a/src/agenda_culturel/templates/agenda_culturel/contactmessage_moderation_form.html +++ b/src/agenda_culturel/templates/agenda_culturel/contactmessage_moderation_form.html @@ -1,7 +1,7 @@ {% extends "agenda_culturel/page.html" %} {% load static %} -{% block title %}Message de contact : {{ obj.subject }}{% endblock %} +{% block title %}{% block og_title %}Message de contact : {{ obj.subject }}{% endblock %}{% endblock %} {% block entete_header %} diff --git a/src/agenda_culturel/templates/agenda_culturel/contactmessages.html b/src/agenda_culturel/templates/agenda_culturel/contactmessages.html index 1d02183..5e1ae2c 100644 --- a/src/agenda_culturel/templates/agenda_culturel/contactmessages.html +++ b/src/agenda_culturel/templates/agenda_culturel/contactmessages.html @@ -1,6 +1,6 @@ {% extends "agenda_culturel/page.html" %} -{% block title %}Derniers messages de contact reçus{% endblock %} +{% block title %}{% block og_title %}Derniers messages de contact reçus{% endblock %}{% endblock %} {% load utils_extra %} {% load cat_extra %} diff --git a/src/agenda_culturel/templates/agenda_culturel/duplicates.html b/src/agenda_culturel/templates/agenda_culturel/duplicates.html index 8e90834..e6bb87d 100644 --- a/src/agenda_culturel/templates/agenda_culturel/duplicates.html +++ b/src/agenda_culturel/templates/agenda_culturel/duplicates.html @@ -3,7 +3,7 @@ {% load utils_extra %} {% load event_extra %} -{% block title %}Événements possiblement dupliqués{% endblock %} +{% block title %}{% block og_title %}Événements possiblement dupliqués{% endblock %}{% endblock %} {% load cat_extra %} {% block entete_header %} diff --git a/src/agenda_culturel/templates/agenda_culturel/event_confirm_change_status.html b/src/agenda_culturel/templates/agenda_culturel/event_confirm_change_status.html index b75509a..2f701dc 100644 --- a/src/agenda_culturel/templates/agenda_culturel/event_confirm_change_status.html +++ b/src/agenda_culturel/templates/agenda_culturel/event_confirm_change_status.html @@ -1,6 +1,6 @@ {% extends "agenda_culturel/page.html" %} -{% block title %} +{% block title %}{% block og_title %} {% if status == "published" %} Publier l'événement {{ event.title }} {% elif status == "draft" %} @@ -8,7 +8,7 @@ Déplacer l'événement {{ event.title }} dans les brouillons {% elif status == "trash" %} Mettre l'événement {{ event.title }} à la corbeille {% endif %} -{% endblock %} +{% endblock %}{% endblock %} {% block content %} diff --git a/src/agenda_culturel/templates/agenda_culturel/event_confirm_delete.html b/src/agenda_culturel/templates/agenda_culturel/event_confirm_delete.html index e783d4b..4c5e16b 100644 --- a/src/agenda_culturel/templates/agenda_culturel/event_confirm_delete.html +++ b/src/agenda_culturel/templates/agenda_culturel/event_confirm_delete.html @@ -1,6 +1,6 @@ {% extends "agenda_culturel/page.html" %} -{% block title %}Supprimer {{ object.title }}{% endblock %} +{% block title %}{% block og_title %}Supprimer {{ object.title }}{% endblock %}{% endblock %} {% block content %} diff --git a/src/agenda_culturel/templates/agenda_culturel/event_form.html b/src/agenda_culturel/templates/agenda_culturel/event_form.html index adfecf3..f1a3284 100644 --- a/src/agenda_culturel/templates/agenda_culturel/event_form.html +++ b/src/agenda_culturel/templates/agenda_culturel/event_form.html @@ -2,7 +2,7 @@ {% load static %} -{% block title %} +{% block title %}{% block og_title %} {% if object %} Édition de l'événement {{ object.title }} ({{ object.start_day }}) {% else %} @@ -12,7 +12,7 @@ Ajouter un événement {% endif %} {% endif %} -{% endblock %} +{% endblock %}{% endblock %} {% block entete_header %} diff --git a/src/agenda_culturel/templates/agenda_culturel/event_import.html b/src/agenda_culturel/templates/agenda_culturel/event_import.html index b09b733..f000dda 100644 --- a/src/agenda_culturel/templates/agenda_culturel/event_import.html +++ b/src/agenda_culturel/templates/agenda_culturel/event_import.html @@ -1,6 +1,6 @@ {% extends "agenda_culturel/page.html" %} -{% block title %}Ajouter un événement{% endblock %} +{% block title %}{% block og_title %}Ajouter un événement{% endblock %}{% endblock %} {% load cat_extra %} diff --git a/src/agenda_culturel/templates/agenda_culturel/event_moderation_form.html b/src/agenda_culturel/templates/agenda_culturel/event_moderation_form.html index 9a5575c..63cb406 100644 --- a/src/agenda_culturel/templates/agenda_culturel/event_moderation_form.html +++ b/src/agenda_culturel/templates/agenda_culturel/event_moderation_form.html @@ -7,7 +7,7 @@ {% endblock %} -{% block title %}Modérer {{ object.title }}{% endblock %} +{% block title %}{% block og_title %}Modérer {{ object.title }}{% endblock %}{% endblock %} diff --git a/src/agenda_culturel/templates/agenda_culturel/fix_duplicate.html b/src/agenda_culturel/templates/agenda_culturel/fix_duplicate.html index 303f618..72b6126 100644 --- a/src/agenda_culturel/templates/agenda_culturel/fix_duplicate.html +++ b/src/agenda_culturel/templates/agenda_culturel/fix_duplicate.html @@ -3,7 +3,7 @@ {% load utils_extra %} {% load event_extra %} -{% block title %}Événements possiblement dupliqués{% endblock %} +{% block title %}{% block og_title %}Événements possiblement dupliqués{% endblock %}{% endblock %} {% load cat_extra %} {% block entete_header %} diff --git a/src/agenda_culturel/templates/agenda_culturel/import.html b/src/agenda_culturel/templates/agenda_culturel/import.html index d093b7d..d5ae706 100644 --- a/src/agenda_culturel/templates/agenda_culturel/import.html +++ b/src/agenda_culturel/templates/agenda_culturel/import.html @@ -1,6 +1,6 @@ {% extends "agenda_culturel/page.html" %} -{% block title %}Importer un événement{% endblock %} +{% block title %}{% block og_title %}Importer un événement{% endblock %}{% endblock %} {% load static %} diff --git a/src/agenda_culturel/templates/agenda_culturel/import_set.html b/src/agenda_culturel/templates/agenda_culturel/import_set.html index 04052a9..ba168a8 100644 --- a/src/agenda_culturel/templates/agenda_culturel/import_set.html +++ b/src/agenda_culturel/templates/agenda_culturel/import_set.html @@ -1,6 +1,6 @@ {% extends "agenda_culturel/page.html" %} -{% block title %}Importer un ensemble d'événements{% endblock %} +{% block title %}{% block og_title %}Importer un ensemble d'événements{% endblock %}{% endblock %} {% load static %} diff --git a/src/agenda_culturel/templates/agenda_culturel/imports.html b/src/agenda_culturel/templates/agenda_culturel/imports.html index 24d3ef0..406686d 100644 --- a/src/agenda_culturel/templates/agenda_culturel/imports.html +++ b/src/agenda_culturel/templates/agenda_culturel/imports.html @@ -1,6 +1,6 @@ {% extends "agenda_culturel/page.html" %} -{% block title %}Importations par lot{% endblock %} +{% block title %}{% block og_title %}Importations par lot{% endblock %}{% endblock %} {% load utils_extra %} {% load cat_extra %} diff --git a/src/agenda_culturel/templates/agenda_culturel/merge_duplicate.html b/src/agenda_culturel/templates/agenda_culturel/merge_duplicate.html index 1c948b5..7d6e997 100644 --- a/src/agenda_culturel/templates/agenda_culturel/merge_duplicate.html +++ b/src/agenda_culturel/templates/agenda_culturel/merge_duplicate.html @@ -3,7 +3,7 @@ {% load utils_extra %} {% load event_extra %} -{% block title %}Fusionner les événements dupliqués{% endblock %} +{% block title %}{% block og_title %}Fusionner les événements dupliqués{% endblock %}{% endblock %} {% load cat_extra %} {% block entete_header %} diff --git a/src/agenda_culturel/templates/agenda_culturel/moderation.html b/src/agenda_culturel/templates/agenda_culturel/moderation.html index 2909cf1..a1bd7a8 100644 --- a/src/agenda_culturel/templates/agenda_culturel/moderation.html +++ b/src/agenda_culturel/templates/agenda_culturel/moderation.html @@ -1,6 +1,6 @@ {% extends "agenda_culturel/page.html" %} -{% block title %}Derniers événements soumis{% endblock %} +{% block title %}{% block og_title %}Derniers événements soumis{% endblock %}{% endblock %} {% load cat_extra %} {% block entete_header %} diff --git a/src/agenda_culturel/templates/agenda_culturel/moderationanswer_confirm_delete.html b/src/agenda_culturel/templates/agenda_culturel/moderationanswer_confirm_delete.html index f94e8b9..6b6d30f 100644 --- a/src/agenda_culturel/templates/agenda_culturel/moderationanswer_confirm_delete.html +++ b/src/agenda_culturel/templates/agenda_culturel/moderationanswer_confirm_delete.html @@ -1,6 +1,6 @@ {% extends "agenda_culturel/page.html" %} -{% block title %}Supprimer la réponse #{{ object.pk }}{% endblock %} +{% block title %}{% block og_title %}Supprimer la réponse #{{ object.pk }}{% endblock %}{% endblock %} {% block content %} diff --git a/src/agenda_culturel/templates/agenda_culturel/moderationanswer_form.html b/src/agenda_culturel/templates/agenda_culturel/moderationanswer_form.html index 6482b0c..be67bfd 100644 --- a/src/agenda_culturel/templates/agenda_culturel/moderationanswer_form.html +++ b/src/agenda_culturel/templates/agenda_culturel/moderationanswer_form.html @@ -1,7 +1,7 @@ {% extends "agenda_culturel/page.html" %} {% load static %} -{% block title %}{% if form.instance.pk %}Modification{% else %}Création{% endif %} d'une réponse de modération{% endblock %} +{% block title %}{% block og_title %}{% if form.instance.pk %}Modification{% else %}Création{% endif %} d'une réponse de modération{% endblock %}{% endblock %} {% block entete_header %} diff --git a/src/agenda_culturel/templates/agenda_culturel/moderationquestion_confirm_delete.html b/src/agenda_culturel/templates/agenda_culturel/moderationquestion_confirm_delete.html index 1f88a12..12780c2 100644 --- a/src/agenda_culturel/templates/agenda_culturel/moderationquestion_confirm_delete.html +++ b/src/agenda_culturel/templates/agenda_culturel/moderationquestion_confirm_delete.html @@ -1,6 +1,6 @@ {% extends "agenda_culturel/page.html" %} -{% block title %}Supprimer la question #{{ object.pk }}{% endblock %} +{% block title %}{% block og_title %}Supprimer la question #{{ object.pk }}{% endblock %}{% endblock %} {% block content %} diff --git a/src/agenda_culturel/templates/agenda_culturel/moderationquestion_detail.html b/src/agenda_culturel/templates/agenda_culturel/moderationquestion_detail.html index cf8eee5..ce4baf7 100644 --- a/src/agenda_culturel/templates/agenda_culturel/moderationquestion_detail.html +++ b/src/agenda_culturel/templates/agenda_culturel/moderationquestion_detail.html @@ -1,6 +1,6 @@ {% extends "agenda_culturel/page.html" %} -{% block title %}Question de modération #{{ object.pk }}{% endblock %} +{% block title %}{% block og_title %}Question de modération #{{ object.pk }}{% endblock %}{% endblock %} {% load tag_extra %} {% load utils_extra %} diff --git a/src/agenda_culturel/templates/agenda_culturel/moderationquestion_form.html b/src/agenda_culturel/templates/agenda_culturel/moderationquestion_form.html index 46280af..185db48 100644 --- a/src/agenda_culturel/templates/agenda_culturel/moderationquestion_form.html +++ b/src/agenda_culturel/templates/agenda_culturel/moderationquestion_form.html @@ -2,9 +2,9 @@ {% load static %} -{% block title %} +{% block title %}{% block og_title %} {% if form.instance.pk %}Modification{% else %}Création{% endif %} d'une question de modération -{% endblock %} +{% endblock %}{% endblock %} {% block content %} diff --git a/src/agenda_culturel/templates/agenda_culturel/moderationquestion_list.html b/src/agenda_culturel/templates/agenda_culturel/moderationquestion_list.html index 608a9a5..939ef79 100644 --- a/src/agenda_culturel/templates/agenda_culturel/moderationquestion_list.html +++ b/src/agenda_culturel/templates/agenda_culturel/moderationquestion_list.html @@ -1,6 +1,6 @@ {% extends "agenda_culturel/page.html" %} -{% block title %}Questions de modération{% endblock %} +{% block title %}{% block og_title %}Questions de modération{% endblock %}{% endblock %} {% load utils_extra %} {% load cat_extra %} diff --git a/src/agenda_culturel/templates/agenda_culturel/page-day.html b/src/agenda_culturel/templates/agenda_culturel/page-day.html index 0348b3f..f72c36d 100644 --- a/src/agenda_culturel/templates/agenda_culturel/page-day.html +++ b/src/agenda_culturel/templates/agenda_culturel/page-day.html @@ -15,9 +15,9 @@ {% endblock %} -{% block title %} +{% block title %}{% block og_title %} {{ day | date:"l j F Y"|frdate }} -{% endblock %} +{% endblock %}{% endblock %} {% block content %} diff --git a/src/agenda_culturel/templates/agenda_culturel/page-event.html b/src/agenda_culturel/templates/agenda_culturel/page-event.html index a4d9242..a75e348 100644 --- a/src/agenda_culturel/templates/agenda_culturel/page-event.html +++ b/src/agenda_culturel/templates/agenda_culturel/page-event.html @@ -1,10 +1,13 @@ {% extends "agenda_culturel/page.html" %} -{% block title %}{{ object.title }}{% endblock %} - {% load cat_extra %} {% load utils_extra %} + +{% block title %}{% block og_title %}{{ event.title }}{% endblock %}{% endblock %} +{% block og_image %}{% if event.has_image_url %}{{ event.get_image_url }}{% else %}{{ block.super }}{% endif %}{% endblock %} +{% block og_description %}{% if event.description %}{{ event.description |truncatewords:20|linebreaks }}{% else %}{{ block.super }}{% endif %}{% endblock %} + {% block entete_header %} {% css_categories %} {% endblock %} diff --git a/src/agenda_culturel/templates/agenda_culturel/page-month.html b/src/agenda_culturel/templates/agenda_culturel/page-month.html index 35ce48a..617287d 100644 --- a/src/agenda_culturel/templates/agenda_culturel/page-month.html +++ b/src/agenda_culturel/templates/agenda_culturel/page-month.html @@ -16,9 +16,9 @@ {% endblock %} -{% block title %} +{% block title %}{% block og_title %} {{ calendar.firstdate | date:"F o" }} -{% endblock %} +{% endblock %}{% endblock %} {% block content %} diff --git a/src/agenda_culturel/templates/agenda_culturel/page-rimport.html b/src/agenda_culturel/templates/agenda_culturel/page-rimport.html index 07033d6..7e0c2b5 100644 --- a/src/agenda_culturel/templates/agenda_culturel/page-rimport.html +++ b/src/agenda_culturel/templates/agenda_culturel/page-rimport.html @@ -1,6 +1,6 @@ {% extends "agenda_culturel/page.html" %} -{% block title %}Import récurrent #{{ object.pk }}{% endblock %} +{% block title %}{% block og_title %}Import récurrent #{{ object.pk }}{% endblock %}{% endblock %} {% load cat_extra %} {% load utils_extra %} diff --git a/src/agenda_culturel/templates/agenda_culturel/page-single.html b/src/agenda_culturel/templates/agenda_culturel/page-single.html index 59ef243..deb21cf 100644 --- a/src/agenda_culturel/templates/agenda_culturel/page-single.html +++ b/src/agenda_culturel/templates/agenda_culturel/page-single.html @@ -9,9 +9,9 @@ {% load static_content_extra %} -{% block title %} +{% block title %}{% block og_title %} {{ title }} -{% endblock %} +{% endblock %}{% endblock %} {% block fluid %}{% endblock %} diff --git a/src/agenda_culturel/templates/agenda_culturel/page-week.html b/src/agenda_culturel/templates/agenda_culturel/page-week.html index b8b4c32..2cce238 100644 --- a/src/agenda_culturel/templates/agenda_culturel/page-week.html +++ b/src/agenda_culturel/templates/agenda_culturel/page-week.html @@ -1,7 +1,6 @@ {% extends "agenda_culturel/page.html" %} - {% load i18n %} {% load cat_extra %} @@ -16,9 +15,7 @@ {% endblock %} -{% block title %} -Semaine du {{ calendar.calendar_days_list.0.date|date|frdate }} -{% endblock %} +{% block title %}{% block og_title %}Semaine du {{ calendar.calendar_days_list.0.date|date|frdate }}{% endblock %}{% endblock %} {% block content %} diff --git a/src/agenda_culturel/templates/agenda_culturel/page.html b/src/agenda_culturel/templates/agenda_culturel/page.html index 6ae90f2..221e9df 100644 --- a/src/agenda_culturel/templates/agenda_culturel/page.html +++ b/src/agenda_culturel/templates/agenda_culturel/page.html @@ -5,8 +5,12 @@
On a rencontré un pépin en cherchant la page que tu as demandé ! N'hésites pas à nous signaler
+ On a rencontré un pépin en cherchant la page que tu as demandée ! N'hésites pas à nous signaler
tout ça si tu penses qu'il y a un bug dans la compote.