1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980 |
- """
- Create or customize your page models here.
- """
- from modelcluster.fields import ParentalKey
- from wagtailcrx.forms import CoderedFormField
- from wagtailcrx.models import (
- CoderedArticlePage,
- CoderedArticleIndexPage,
- CoderedEmail,
- CoderedFormPage,
- CoderedWebPage
- )
- class ArticlePage(CoderedArticlePage):
- """
- Article, suitable for news or blog content.
- """
- class Meta:
- verbose_name = 'Article'
- ordering = ['-first_published_at']
- # Only allow this page to be created beneath an ArticleIndexPage.
- parent_page_types = ['website.ArticleIndexPage']
- template = 'wagtailcrx/pages/article_page.html'
- search_template = 'wagtailcrx/pages/article_page.search.html'
- class ArticleIndexPage(CoderedArticleIndexPage):
- """
- Shows a list of article sub-pages.
- """
- class Meta:
- verbose_name = 'Article Landing Page'
- # Override to specify custom index ordering choice/default.
- index_query_pagemodel = 'website.ArticlePage'
- # Only allow ArticlePages beneath this page.
- subpage_types = ['website.ArticlePage']
- template = 'wagtailcrx/pages/article_index_page.html'
- class FormPage(CoderedFormPage):
- """
- A page with an html <form>.
- """
- class Meta:
- verbose_name = 'Form'
- template = 'wagtailcrx/pages/form_page.html'
- class FormPageField(CoderedFormField):
- """
- A field that links to a FormPage.
- """
- class Meta:
- ordering = ['sort_order']
- page = ParentalKey('FormPage', related_name='form_fields')
- class FormConfirmEmail(CoderedEmail):
- """
- Sends a confirmation email after submitting a FormPage.
- """
- page = ParentalKey('FormPage', related_name='confirmation_emails')
- class WebPage(CoderedWebPage):
- """
- General use page with featureful streamfield and SEO attributes.
- """
- class Meta:
- verbose_name = 'Web Page'
- template = 'wagtailcrx/pages/web_page.html'
|