Ajout de la liste des imports automatiques

This commit is contained in:
Jean-Marie Favreau 2024-04-21 11:25:31 +02:00
parent 4aefe04f29
commit 472a33d91b
3 changed files with 26 additions and 2 deletions

View File

@ -789,6 +789,9 @@ class RecurrentImport(models.Model):
def nb_imports(self): def nb_imports(self):
return BatchImportation.objects.filter(recurrentImport=self).count() 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): def get_absolute_url(self):
return reverse("view_rimport", kwargs={"pk": self.pk}) return reverse("view_rimport", kwargs={"pk": self.pk})

View File

@ -0,0 +1,20 @@
{% extends "agenda_culturel/page-single.html" %}
{% block content %}
<article>
<header>
<h1>{{ title }}</h1>
</header>
{% include "agenda_culturel/static_content.html" with name=static_content url_path=url_path %}
<h2>Imports automatiques</h2>
<p>L'agenda est régulièrement mis à jour avec les événements publiés par les structures
organisatrices suivantes&nbsp;:</p>
<ul>
{% for rimport in rimports %}
<li><a href="{{ rimport.browsable_url }}">{{ rimport.name }}</a> ({{ rimport.nb_events }} événements importés)</li>
{% endfor %}
</ul>
</article>
{% endblock %}

View File

@ -148,8 +148,9 @@ def mentions_legales(request):
return render(request, 'agenda_culturel/page-single.html', context) return render(request, 'agenda_culturel/page-single.html', context)
def about(request): def about(request):
context = { "title": "À propos", "static_content": "about", "url_path": reverse_lazy("about") } rimports = RecurrentImport.objects.order_by("name").all()
return render(request, 'agenda_culturel/page-single.html', context) 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): def home(request):