Need ability to restrict parent page types to "root" page
See original GitHub issueI want the editor to be able to add a homepage as a child of the “root” page only. Currently there’s no way to do that.
The workaround is to use a fixture (or migration) to make the homepage, then restrict its subpage and parent page types to []
. But that doesn’t stop the editor from deleting the homepage. If they do, they can’t add one back again.
The correct behavior should be to set parent_page_types = ['root']
(maybe a special string) to restrict pages from only being able to be added to the root page.
Issue Analytics
- State:
- Created 7 years ago
- Comments:9 (3 by maintainers)
Top Results From Across the Web
Restricting Parent and Child Pages
In this video we'll explore how to restrict where pages can live by telling the parent page what types of child page(s) they...
Read more >Page type restriction to root page
Hi,. I need to apply page type restriction to root page structure.My cms site page root structure look like this: - Root. -The...
Read more >Limit HomePage via parent_page_types to be only ...
Try this: parent_page_types = ['wagtailcore.Page']. also, for completeness, to allow only one instance of a Homepage, add this classmethod ...
Read more >Wagtail CMS: Restricting Parent and Child Page Types
When you start to create several different page types in Wagtail and you create a child page (a page that's nested under a...
Read more >Parent and child pages: Linking hierarchical post types for ...
A child page can only have one parent page, but a parent page can have multiple child pages. So a child page can...
Read more >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
I think
parent_page_types = ['wagtailcore.Page']
will also work, as the root is the only valid instance of the bare Page class.But yep, we ought to come up with something better… https://github.com/torchbox/wagtail/pull/1736#issuecomment-160944662 has a good suggestion for implementing this.
This should also be added to the docs 📖