From 7ed5c383d82619a288797df0ae58b3041019f1e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Th=C3=A9o=20Lesage?= <tlesage@teklia.com> Date: Fri, 26 Apr 2024 15:01:37 +0200 Subject: [PATCH] Better restart validation test --- arkindex/ponos/api.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arkindex/ponos/api.py b/arkindex/ponos/api.py index 60ae9d1725..e27af396b7 100644 --- a/arkindex/ponos/api.py +++ b/arkindex/ponos/api.py @@ -223,7 +223,7 @@ class TaskRestart(ProcessACLMixin, CreateAPIView): raise ValidationError( detail="Task's state must be in a final state to be restarted." ) - if len(Task.objects.filter(original_task=task)) > 0: + if task.restarts.exists(): raise ValidationError( detail="This task has already been restarted." ) -- GitLab