Zacharie Roy
Zacharie Roy

Reputation: 45

Add page child button needs to be effective only on first level

On click "Add page child" I want to be able to add a page only when I'm on the first level (homepage). The page model doesn't need to be selected.

Upvotes: 0

Views: 58

Answers (1)

Loïc Teixeira
Loïc Teixeira

Reputation: 1434

You can control where can pages be inserted with parent_page_types and subpage_types (see documentation)

For example, the following will only allow the ChildPage to be created underneath the HomePage.

class ChildPage(Page):
    parent_page_type = ['my_app.HomePage']

Upvotes: 2

Related Questions