on affiche le dernier status

This commit is contained in:
Jean-Marie Favreau 2024-04-20 10:07:01 +02:00
parent 909b73d729
commit a7f5645cf1
2 changed files with 13 additions and 1 deletions

View File

@ -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):

View File

@ -22,7 +22,8 @@
<th>Id</th>
<th>Nom</th>
<th>Récurrence</th>
<th>Nombre d'imports</th>
<th>Nb d'imports</th>
<th>Dernier</th>
<th>Actions</th>
</tr>
</thead>
@ -33,6 +34,13 @@
<td>{{ obj.name }}</a></td>
<td>{{ obj.get_recurrence_display }}</td>
<td>{{ obj.nb_imports }}</td>
<td>
{% if obj.nb_imports > 0 %}
{% with imp=obj.last_import %}
<span{% if imp.status == "failed" %} data-tooltip="{{ imp.error_message }}"{% endif %}>{{ imp.status }}</span>
{% endwith %}
{% endif %}
</td>
<td>
<div class="buttons">
<a href="{% url 'run_rimport' obj.pk %}" role="button">Exécuter</a>