From 472a33d91be8dcabb597fa960d3aaec92df183e3 Mon Sep 17 00:00:00 2001 From: Jean-Marie Favreau Date: Sun, 21 Apr 2024 11:25:31 +0200 Subject: [PATCH] Ajout de la liste des imports automatiques --- src/agenda_culturel/models.py | 3 +++ .../agenda_culturel/page-rimports-list.html | 20 +++++++++++++++++++ src/agenda_culturel/views.py | 5 +++-- 3 files changed, 26 insertions(+), 2 deletions(-) create mode 100644 src/agenda_culturel/templates/agenda_culturel/page-rimports-list.html diff --git a/src/agenda_culturel/models.py b/src/agenda_culturel/models.py index 988136a..1f4e0e0 100644 --- a/src/agenda_culturel/models.py +++ b/src/agenda_culturel/models.py @@ -789,6 +789,9 @@ class RecurrentImport(models.Model): def nb_imports(self): return BatchImportation.objects.filter(recurrentImport=self).count() + def nb_events(self): + return Event.objects.filter(import_sources__contains=[self.source]).count() + def get_absolute_url(self): return reverse("view_rimport", kwargs={"pk": self.pk}) diff --git a/src/agenda_culturel/templates/agenda_culturel/page-rimports-list.html b/src/agenda_culturel/templates/agenda_culturel/page-rimports-list.html new file mode 100644 index 0000000..49e18c5 --- /dev/null +++ b/src/agenda_culturel/templates/agenda_culturel/page-rimports-list.html @@ -0,0 +1,20 @@ +{% extends "agenda_culturel/page-single.html" %} + + {% block content %} +
+
+

{{ title }}

+
+ {% include "agenda_culturel/static_content.html" with name=static_content url_path=url_path %} +

Imports automatiques

+

L'agenda est régulièrement mis à jour avec les événements publiés par les structures + organisatrices suivantes :

+ +
+ + + {% endblock %} \ No newline at end of file diff --git a/src/agenda_culturel/views.py b/src/agenda_culturel/views.py index e0909ae..e2f01ee 100644 --- a/src/agenda_culturel/views.py +++ b/src/agenda_culturel/views.py @@ -148,8 +148,9 @@ def mentions_legales(request): return render(request, 'agenda_culturel/page-single.html', context) def about(request): - context = { "title": "À propos", "static_content": "about", "url_path": reverse_lazy("about") } - return render(request, 'agenda_culturel/page-single.html', context) + rimports = RecurrentImport.objects.order_by("name").all() + context = { "title": "À propos", "static_content": "about", "url_path": reverse_lazy("about"), "rimports": rimports } + return render(request, 'agenda_culturel/page-rimports-list.html', context) def home(request):