Skip to content
Permalink
Browse files

Restricting Page Hierarchy

  • Loading branch information
KalobTaulien committed Mar 25, 2019
1 parent ec1b75b commit c4cf47b16221b71a4f2bf4419590400df25333df
Showing with 21 additions and 2 deletions.
  1. +5 −0 blog/models.py
  2. +3 −0 contact/models.py
  3. +5 −1 flex/models.py
  4. +8 −1 home/models.py
@@ -154,6 +154,8 @@ class BlogListingPage(RoutablePageMixin, Page):
"""Listing page lists all the Blog Detail Pages."""

template = "blog/blog_listing_page.html"
max_count = 1
subpage_types = ['blog.VideoBlogPage', 'blog.ArticleBlogPage']

custom_title = models.CharField(
max_length=100,
@@ -215,6 +217,9 @@ def get_sitemap_urls(self, request):
class BlogDetailPage(Page):
"""Parental blog detail page."""

subpage_types = []
parent_page_types = ['blog.BlogListingPage']

custom_title = models.CharField(
max_length=100,
blank=False,
@@ -24,6 +24,9 @@ class FormField(AbstractFormField):
class ContactPage(WagtailCaptchaEmailForm):

template = "contact/contact_page.html"
subpage_types = []
parent_page_types = ['home.HomePage']

# This is the default path.
# If ignored, Wagtail adds _landing.html to your template name
landing_page_template = "contact/contact_page_landing.html"
@@ -12,7 +12,11 @@ class FlexPage(Page):
"""Flexible page class."""

template = "flex/flex_page.html"

subpage_types = ['flex.FlexPage', 'contact.ContactPage']
parent_page_types = [
'flex.FlexPage',
'home.HomePage',
]
content = StreamField(
[
("title_and_text", blocks.TitleAndTextBlock()),
@@ -43,7 +43,14 @@ class HomePage(RoutablePageMixin, Page):
"""Home page model."""

template = "home/home_page.html"
max_count = 1
subpage_types = [
'blog.BlogListingPage',
'contact.ContactPage',
'flex.FlexPage',
]
parent_page_type = [
'wagtailcore.Page'
]

banner_title = models.CharField(max_length=100, blank=False, null=True)
banner_subtitle = RichTextField(features=["bold", "italic"])

1 comment on commit c4cf47b

@KalobTaulien

This comment has been minimized.

Copy link
Member Author

KalobTaulien commented on c4cf47b Apr 4, 2019

Please sign in to comment.
You can’t perform that action at this time.