Search code examples
wagtail

Limit HomePage via parent_page_types to be only available as direct child of root


I use parent_page_types and subpage_types happily all around my Page-models.

But I'm stuck at allowing my class HomePage(Page) only as a direct child at root level.

Any hints?


Solution

  • Updated Answer: If you are landing here on 2023 like me there is an easier way to do this now. Just add max_count prop to your model like so:

    class HomePage(Page):
        #...
    
        max_count = 1