Sorting pages with a parent_page_types restriction raises a MovePagePermissionError
See original GitHub issueIssue Summary
If you have a list of pages that are restricted to a certain parent page type and you toggle the sorting via “sort menu order”, sorting raises a MovePagePermissionError.
Steps to Reproduce
- Start a new project with
wagtail start myproject
- Edit home/models.py, and add another page type:
class AnotherPage(Page):
parent_page_types = ["home.HomePage"]
- run
python manage.py makemigrations
andpython manage.py migrate
- Go to the Wagtail Admin, and add a few child pages under the
Home
page - While viewing the contents of the
Home
page, toggle the page sorting option via More -> Sort Menu Order: - Try to reorder the pages. The order is not being saved. My local development server outputs the following:
raise MovePagePermissionError(
wagtail.core.actions.move_page.MovePagePermissionError: You do not have permission to move the page to the target specified.
If I remove the parent_page_types restriction from the model definition, everything works as expected.
- I have confirmed that this issue can be reproduced as described on a fresh Wagtail project: (yes / ~no~)
Technical details
- Python version: 3.9.7
- Django version: 3.2.12 and 4.0.2
- Wagtail version: 2.16.1
- Browser version: Firefox 96.0.3
Issue Analytics
- State:
- Created 2 years ago
- Reactions:4
- Comments:13 (13 by maintainers)
Top Results From Across the Web
No results found
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Is there anything I have to do that prevents this PR from being merged?
Update:
parent.specific_class
is wrong (it’s the same as thecls
in this case. But it’s definitely not the case.The
parent
is wrong is this case. It’s not the parent but thetarget
page (left/right pos)…Making this
parent
(a trace higher) also wrong:This
parent
is also wrong.Highest trace is this:
This returns
False
incan_move_to
:This code uses the
can_move_to
from aPage
(see first code snippet here) and that’s expecint a trulyparent
but it’s not… as this is thedestination
page (left/rigth), so from the same page type.