From 15ed2bbf5b4e02bcd5e99aab1a756a8c5b6cffc8 Mon Sep 17 00:00:00 2001 From: monsieurswag Date: Mon, 21 Oct 2024 18:25:49 +0200 Subject: [PATCH] Replace the sub_folders usage with get_sub_folders --- backend/core/helpers.py | 2 +- backend/core/views.py | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/backend/core/helpers.py b/backend/core/helpers.py index 9653d254c7..2584b4e29e 100644 --- a/backend/core/helpers.py +++ b/backend/core/helpers.py @@ -1250,7 +1250,7 @@ def duplicate_and_link_object(new_obj, duplicate_object, target_folder, field_na # Get parent and sub-folders of the target folder target_parent_folders = target_folder.get_parent_folders() - sub_folders = target_folder.sub_folders() + sub_folders = target_folder.get_sub_folders() # Get all related objects for the specified field related_objects = getattr(source_object, field_name).all() diff --git a/backend/core/views.py b/backend/core/views.py index 47d1c90ee9..25d0befc3d 100644 --- a/backend/core/views.py +++ b/backend/core/views.py @@ -650,8 +650,9 @@ def duplicate(self, request, pk): if ( duplicate_risk_assessment.project.folder - in [risk_assessment.project.folder] - + risk_assessment.project.folder.sub_folders() + == risk_assessment.project.folder + or duplicate_risk_assessment.project.folder + in risk_assessment.project.folder.get_sub_folders() ): duplicate_scenario.owner.set(scenario.owner.all())