123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177 |
- from wagtailcrx.models.page_models import CoderedPage
- from modelcluster.fields import ParentalKey
- from wagtailcrx.forms import CoderedFormField
- from wagtailcrx.models import (
- CoderedArticlePage,
- CoderedArticleIndexPage,
- CoderedEventIndexPage,
- CoderedEventPage,
- CoderedEventOccurrence,
- CoderedEmail,
- CoderedFormPage,
- CoderedLocationIndexPage,
- CoderedLocationPage,
- CoderedStreamFormPage,
- 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 = ['testapp.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'
- index_order_by_default = ''
- # Override to specify custom index ordering choice/default.
- index_query_pagemodel = 'testapp.ArticlePage'
- # Only allow ArticlePages beneath this page.
- subpage_types = ['testapp.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'
- class EventPage(CoderedEventPage):
- class Meta:
- verbose_name = 'Event Page'
- parent_page_types = ['testapp.EventIndexPage']
- subpage_types = []
- template = 'wagtailcrx/pages/event_page.html'
- class EventIndexPage(CoderedEventIndexPage):
- """
- Shows a list of event sub-pages.
- """
- class Meta:
- verbose_name = 'Events Landing Page'
- index_query_pagemodel = 'testapp.EventPage'
- index_order_by_default = ''
- # Only allow EventPages beneath this page.
- subpage_types = ['testapp.EventPage']
- template = 'wagtailcrx/pages/event_index_page.html'
- class EventOccurrence(CoderedEventOccurrence):
- event = ParentalKey(EventPage, related_name='occurrences')
- class LocationPage(CoderedLocationPage):
- """
- A page that holds a location. This could be a store, a restaurant, etc.
- """
- class Meta:
- verbose_name = 'Location Page'
- template = 'wagtailcrx/pages/location_page.html'
- # Only allow LocationIndexPages above this page.
- parent_page_types = ['testapp.LocationIndexPage']
- class LocationIndexPage(CoderedLocationIndexPage):
- """
- A page that holds a list of locations and displays them with a Google Map.
- This does require a Google Maps API Key that can be defined in Settings >
- Google API Settings
- """
- class Meta:
- verbose_name = 'Location Landing Page'
- # Override to specify custom index ordering choice/default.
- index_query_pagemodel = 'testapp.LocationPage'
- # Only allow LocationPages beneath this page.
- subpage_types = ['testapp.LocationPage']
- template = 'wagtailcrx/pages/location_index_page.html'
- class StreamFormPage(CoderedStreamFormPage):
- class Meta:
- verbose_name = 'Stream Form'
- template = 'wagtailcrx/pages/stream_form_page.html'
- class StreamFormConfirmEmail(CoderedEmail):
- page = ParentalKey('StreamFormPage', related_name='confirmation_emails')
- """
- --------------------------------------------------------------------------------
- CUSTOM PAGE TYPES for testing specific features. These should be based on
- CoderedPage when testing CoderedPage-specific functionality (which is where most
- of our logic lives).
- --------------------------------------------------------------------------------
- """
- class IndexTestPage(CoderedPage):
- """
- Tests indexing features (show/sort/filter child pages).
- """
- class Meta:
- verbose_name = "Index Test Page"
- index_query_pagemodel = "testapp.WebPage"
- template = 'wagtailcrx/pages/base.html'
|