From c235061eecb93bed85db017fbde42bb4e8f12dc3 Mon Sep 17 00:00:00 2001 From: Horilla Date: Fri, 12 Jul 2024 12:33:24 +0530 Subject: [PATCH] [FIX] HORILLA AUTOMATIONS: List index out of range error --- horilla_automations/signals.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/horilla_automations/signals.py b/horilla_automations/signals.py index 0d418de70..19882fb65 100644 --- a/horilla_automations/signals.py +++ b/horilla_automations/signals.py @@ -176,10 +176,13 @@ def start_automation(): def pre_bulk_update_handler(sender, queryset, *args, **kwargs): request = getattr(_thread_locals, "request", None) if request: + queryset_copy = queryset.none() + if queryset.count(): + queryset_copy = QuerySet.from_list(copy.deepcopy(list(queryset))) _thread_locals.previous_bulk_record = { "automation": automation, "queryset": queryset, - "queryset_copy": QuerySet.from_list(copy.deepcopy(list(queryset))), + "queryset_copy": queryset_copy, } func_name = f"{automation.method_title}_pre_bulk_signal_handler"