diff --git a/src/agenda_culturel/models.py b/src/agenda_culturel/models.py index 94493b6..01d486c 100644 --- a/src/agenda_culturel/models.py +++ b/src/agenda_culturel/models.py @@ -789,6 +789,10 @@ class RecurrentImport(models.Model): def get_absolute_url(self): return reverse("view_rimport", kwargs={"pk": self.pk}) + + def last_import(self): + events = BatchImportation.objects.filter(recurrentImport=self).order_by("-created_date") + return events[0] class BatchImportation(models.Model): diff --git a/src/agenda_culturel/templates/agenda_culturel/rimports.html b/src/agenda_culturel/templates/agenda_culturel/rimports.html index 27dc55f..9c2156d 100644 --- a/src/agenda_culturel/templates/agenda_culturel/rimports.html +++ b/src/agenda_culturel/templates/agenda_culturel/rimports.html @@ -22,7 +22,8 @@ Id Nom RĂ©currence - Nombre d'imports + Nb d'imports + Dernier Actions @@ -33,6 +34,13 @@ {{ obj.name }} {{ obj.get_recurrence_display }} {{ obj.nb_imports }} + + {% if obj.nb_imports > 0 %} + {% with imp=obj.last_import %} + {{ imp.status }} + {% endwith %} + {% endif %} +
Exécuter