From d05095b4c3bd6db06e71e949442a68b6d7c962be Mon Sep 17 00:00:00 2001 From: Tidiane Dia Date: Fri, 7 Jan 2022 12:03:31 +0000 Subject: [PATCH] Prevent update_locale to be used for pages that aren't at the root of the tree --- wagtail/core/actions/create_alias.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/wagtail/core/actions/create_alias.py b/wagtail/core/actions/create_alias.py index f6c339fbef..367d243ab6 100644 --- a/wagtail/core/actions/create_alias.py +++ b/wagtail/core/actions/create_alias.py @@ -82,6 +82,10 @@ class CreatePageAliasAction: raise CreatePageAliasIntegrityError( "You cannot copy a tree branch recursively into itself" ) + if not parent.is_root() and self.update_locale is not None: + raise CreatePageAliasIntegrityError( + "You cannot manually set locale of a page that's not at the root of the tree." + ) if ( self.user