question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Need ability to restrict parent page types to "root" page

See original GitHub issue

I 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:closed
  • Created 7 years ago
  • Comments:9 (3 by maintainers)

github_iconTop GitHub Comments

8reactions
gasmancommented, Jun 21, 2016

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.

6reactions
bryliecommented, Nov 12, 2018

This should also be added to the docs 📖

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found