From c5a277a9278e838d11a27adfb4e7ea069e1c87ca Mon Sep 17 00:00:00 2001 From: J-E Castagnede Date: Mon, 30 Jan 2023 15:34:38 +0100 Subject: [PATCH] keep always same path order for merge --- geotrek/core/views.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/geotrek/core/views.py b/geotrek/core/views.py index 54c1682a6c..4f999f6ef9 100644 --- a/geotrek/core/views.py +++ b/geotrek/core/views.py @@ -308,9 +308,9 @@ def merge_path(self, request, *args, **kwargs): if len(ids_path_merge) != 2: raise Exception(_("You should select two paths")) - - path_a = Path.objects.get(pk=ids_path_merge[0]) - path_b = Path.objects.get(pk=ids_path_merge[1]) + paths = [int(path) for path in ids_path_merge] + path_a = Path.objects.get(pk=min(paths)) + path_b = Path.objects.get(pk=max(paths)) if not path_a.same_structure(request.user) or not path_b.same_structure(request.user): raise Exception(_("You don't have the right to change these paths"))