On corrige un bug en cas de création sans run

This commit is contained in:
Jean-Marie Favreau 2024-09-22 12:15:24 +02:00
parent e04d94f97a
commit 2bc1f36139
2 changed files with 5 additions and 2 deletions

View File

@ -1364,7 +1364,10 @@ class RecurrentImport(models.Model):
events = BatchImportation.objects.filter(recurrentImport=self).order_by(
"-created_date"
)
if events and len(events) > 0:
return events[0]
else:
return None
class BatchImportation(models.Model):

View File

@ -82,7 +82,7 @@
</td>
<td>
<div class="buttons">
{% if obj.last_import.status != "running" %}
{% if not obj.last_import or obj.last_import.status != "running" %}
<a href="{% url 'run_rimport' obj.pk %}" role="button">Exécuter</a>
{% else %}
<a href="{% url 'cancel_import' obj.last_import.pk %}" role="button">Annuler</a>