Skip to content

Commit

Permalink
keep always same path order for merge
Browse files Browse the repository at this point in the history
  • Loading branch information
submarcos committed Jan 30, 2023
1 parent 8fad686 commit 2141b77
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions geotrek/core/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"))
Expand Down

0 comments on commit 2141b77

Please sign in to comment.