class FlexPage(Page): template = "flex/flex_page.html" #@todo add streamfields content = StreamField( [ ("title_and_text", blocks.TitleAndTextBlock()), ("full_richtext", blocks.RichtextBlock()), ("simple_richtext", blocks.SimpleRichtextBlock()), ("cards", blocks.CardBlock()), ("cta", blocks.CTABlock()) ], null=True, blank=True, ) subtitle = models.CharField(max_length=100, null=True, blank=True) content_panels = Page.content_panels + [ FieldPanel("subtitle"), StreamFieldPanel("content"), ] class Meta: verbose_name = "Flex Page" verbose_name_plural = "Flex Pages"
class BlogDetailPage(Page): """Parental blog detail page.""" subpage_types = [] parent_page_types = ['blog.BlogListingPage'] tags = ClusterTaggableManager(through=BlogPageTag, blank=True) custom_title = models.CharField( max_length=100, blank=False, null=False, help_text='Overwrites the default title', ) banner_image = models.ForeignKey( "wagtailimages.Image", blank=False, null=True, related_name="+", on_delete=models.SET_NULL, ) categories = ParentalManyToManyField("blog.BlogCategory", blank=True) content = StreamField( [ ("title_and_text", blocks.TitleAndTextBlock()), ("full_richtext", blocks.RichtextBlock()), ("simple_richtext", blocks.SimpleRichtextBlock()), ("cards", blocks.CardBlock()), ("cta", blocks.CTABlock()), ], null=True, blank=True, ) content_panels = Page.content_panels + [ FieldPanel("custom_title"), FieldPanel("tags"), ImageChooserPanel("banner_image"), MultiFieldPanel([ InlinePanel("blog_authors", label="Author", min_num=1, max_num=4) ], heading="Author(s)"), MultiFieldPanel( [FieldPanel("categories", widget=forms.CheckboxSelectMultiple)], heading="Categories"), StreamFieldPanel("content"), ] api_fields = [ APIField("blog_authors"), APIField("content"), ] def save(self, *args, **kwargs): """Create a template fragment key. Then delete the key.""" key = make_template_fragment_key("blog_post_preview", [self.id]) cache.delete(key) return super().save(*args, **kwargs)
class BlogAbout(Page): subpage_types = [] max_count = 1 address = models.CharField(max_length=250, blank=True, null=True) location = models.CharField(max_length=250, blank=True, null=True) content = StreamField([ ("title_and_text", blocks.TitleAndTextBlock()), ("Full_richtext", blocks.RichtextBlock()), ("card_block", blocks.CardBlock()), ], null=True, blank=True) subtitle = models.CharField(max_length=250, blank=True, null=True) content_panels = Page.content_panels + [ FieldPanel('subtitle'), StreamFieldPanel("content"), MultiFieldPanel([ FieldPanel('address'), GeoPanel('location', address_field='address'), ], _('Geo details')), ] @cached_property def point(self): return geosgeometry_str_to_struct(self.location) @property def lat(self): return self.point['y'] @property def lng(self): return self.point['x']
class BlogPage(Page): date = models.DateField("Post date") banner_image = models.ForeignKey("wagtailimages.Image", null=True, blank=True, on_delete=models.SET_NULL, related_name="+") intro_image = models.ForeignKey( "wagtailimages.Image", blank=True, null=True, on_delete=models.SET_NULL, help_text='Best size for this image will be 1400x400') intro = models.CharField(max_length=250) body = StreamField( [ ("full_richtext", blocks.RichtextBlock()), ("simple_richtext", blocks.SimpleRichtextBlock()), ("cards", blocks.CardBlock()), ("cta", blocks.CTABlock()), ], null=True, blank=True, ) content_panels = Page.content_panels + [ FieldPanel('date'), ImageChooserPanel("banner_image"), ImageChooserPanel("intro_image"), FieldPanel('intro'), StreamFieldPanel('body'), ]
class StandardPage(Page): """Standard page model""" template = "standard/standard_page.html" search_fields = Page.search_fields + [ index.SearchField('search_description') ] body = StreamField( [ ("richtext", blocks.RichtextBlock(group="Format and Text")), ("two_column_block", blocks.ColumnsBlock(group="Format and Text")), ("info_box_block", blocks.InfoBoxBlock(group="Format and Text")), ("footnote_block", blocks.FootnoteBlock(group="Format and Text")), ("image_block", blocks.ImageBlock(group="Layout and Images")), ("fellows_block", blocks.FellowsBlock(group="Layout and Images")), ("clear_block", blocks.ClearBlock(group="Layout and Images")), ], null=True, blank=True, ) content_panels = Page.content_panels + [ StreamFieldPanel("body"), MultiFieldPanel( [InlinePanel("sidebar", max_num=3, label="Sidebar Section")], heading="Sidebar", ), ] class Meta: verbose_name = "Standard Page" verbose_name_plural = "Standard Pages"
class NewsletterSignupPage(Page): """Page for embedded Newsletter form code""" max_count = 1 subpage_types = [] parent_page_types = ['news.NewsIndexPage'] search_fields = Page.search_fields + [ index.SearchField('search_description') ] body = StreamField( [ ("richtext", blocks.RichtextBlock()), ("webfeed", blocks.WebFeedBlock()), ("image_block", blocks.ImageBlock()), ], null=True, blank=True, ) content_panels = Page.content_panels + [ StreamFieldPanel("body"), ] class Meta: verbose_name = "Newsletter Form" verbose_name_plural = "Newsletter Forms"
class HomePage(Page): lead_image = models.ForeignKey( "wagtailimages.Image", null=True, blank=True, on_delete=models.SET_NULL, related_name="+", ) content = StreamField( [ ("cta", blocks.CTABlock()), ("title_and_text", blocks.TitleAndTextBlock()), ("full_richtext", blocks.RichtextBlock()), ("left_card_block", blocks.LeftCardBlock()), ("right_card_block", blocks.RightCardBlock()), ("three_image_block", blocks.ThreeCardBlock()), ("two_image_block", blocks.TwoImageBlock()), ], null=True, blank=True, ) content_panels = Page.content_panels + [ ImageChooserPanel("lead_image"), StreamFieldPanel("content"), ] class Meta: verbose_name = "Home Page" verbose_name_plural = "Home Pages"
class JournalPage(Page): """Journal page class.""" template = "journal/journal_page.html" content = StreamField( [ ("title_and_text", blocks.TitleAndTextBlock()), ("full_richtext", blocks.RichtextBlock()), ("simple_richtext", blocks.SimpleRichtextBlock()), ("Raw_HTML", blocks.RawHTMLBlock()), ("cards", blocks.CardBlock()), ], null=True, blank=True, ) subtitle = models.CharField(max_length=100, null=True, blank = True) content_panels = Page.content_panels + [ FieldPanel("subtitle"), StreamFieldPanel("content"), ] class Meta: # noqa verbose_name = "Journal Page" verbose_name_plural = "Journal Pages"
class BlogPage(Page): date = models.DateField("Post Date") intro = models.CharField(max_length = 250) body = RichTextField(blank = True) tags = ClusterTaggableManager(through=BlogTag, blank = True) categories = ParentalManyToManyField('blog.BlogCategory', blank = True) content = StreamField( [ ("title_and_text", blocks.TitleAndTextBlock()), ("full_richtext", blocks.RichtextBlock()), ("simple_richtext", blocks.SimpleRichtextBlock()), ("cards", blocks.CardBlock()), ("cta", blocks.CTABlock()), ], null=True, blank=True, ) search_fields = Page.search_fields + [ index.SearchField('intro'), index.SearchField('body'), ] content_panels = Page.content_panels + [ MultiFieldPanel([ FieldPanel('date'), FieldPanel('tags'), FieldPanel('categories', widget = forms.CheckboxSelectMultiple), ], heading = "Blog Information"), FieldPanel('intro'), StreamFieldPanel("content"), InlinePanel('gallery_images', label = "Gallery images"), ]
class FlexPage(Page): template = "flex/flex_page.html" content = StreamField([ ("column_wide_image", blocks.ColumnWideImageBlock()), ("cta", blocks.CTABlock()), ("left_card_block", blocks.LeftCardBlock()), ("full_richtext", blocks.RichtextBlock()), ("right_card_block", blocks.RightCardBlock()), ("three_image_block", blocks.ThreeCardBlock()), ("two_column_text", blocks.TwoColumnTextBlock()), ("title_and_text", blocks.TitleAndTextBlock()), ("two_image_block", blocks.TwoImageBlock()), ], null=True, blank=True) subtitle = models.CharField(max_length=100, null=True, blank=True) content_panels = Page.content_panels + [ FieldPanel("subtitle"), StreamFieldPanel("content"), ] class Meta: verbose_name = "Flex Page" verbose_name_plural = "Flex Pages"
class StandardPage(Page): """Standard page class.""" template = "standard/standard_page.html" # @todo add streamfields content = StreamField( [ ("title_and_text", blocks.TitleAndTextBlock()), ("simple_richtext", blocks.RichtextBlock()), ], null=True, blank=True, ) page_image = models.ForeignKey("wagtailimages.Image", null=True, blank=False, on_delete=models.SET_NULL, related_name="+") subtitle = models.CharField(max_length=100, null=True, blank=True) content_panels = Page.content_panels + [ FieldPanel("subtitle"), ImageChooserPanel("page_image"), StreamFieldPanel("content"), ] class Meta: # noqa verbose_name = "Standard Page" verbose_name_plural = "Standard Pages"
class MembCollectionIndexPage(Page): """Landing page for member collection search box""" template = "memb_collections/memb_collections_index_page.html" max_count = 1 subpage_types = [] parent_page_types = ['home.HomePage'] search_fields = Page.search_fields + [ index.SearchField('search_description') ] body = StreamField( [ ("richtext", blocks.RichtextBlock()), ("image_block", blocks.ImageBlock()), ("new_row", blocks.NewRow()), ("memb_coll_search_block", blocks.MembCollSearchBlock()), ], null=True, blank=True, ) content_panels = Page.content_panels + [ StreamFieldPanel("body"), MultiFieldPanel( [InlinePanel("sidebar", max_num=3, label="Sidebar Section")], heading="Sidebar", ), ] class Meta: verbose_name = "Member Collection Index Page" verbose_name_plural = "Member Collection Index Pages"
class FlexPage(Page): """Flexible page class.""" template = "flex/flex_page.html" content = StreamField( [ ("full_richtext", blocks.RichtextBlock(classname="richtext")), ("features_and_tools", blocks.FeaturesAndToolsBlock(classname="featuresandtools")), ("codeblock", CodeBlock(label='Code Block', default_language='python')) ], null=True, blank=True ) subtitle = models.CharField(max_length=100, null=True, blank=True) content_panels = Page.content_panels + [ FieldPanel("subtitle"), StreamFieldPanel("content"), ] class Meta: verbose_name = "Flex Page" verbose_name_plural = "Flex Pages"
class FlexPage(Page): """Flexible page class.""" template = "flex/flex_page.html" content = StreamField([ ("title_and_text", blocks.TitleAndTextBlock()), ("full_richtext", blocks.RichtextBlock()), ("simple_richtext", blocks.SimpleRichTextBlock()), ("cards", blocks.CardBlock()), ("cta", blocks.CTABlock()), ("button", blocks.ButtonBlock()), ], null=True, blank=True) subtitle = models.CharField(max_length=100, null=True, blank=True) content_panels = Page.content_panels + [ FieldPanel("subtitle"), StreamFieldPanel("content"), ] class Meta: # noqa verbose_name = "Flex Page" verbose_name_plural = "Flex Pages"
class BlogDetailPage(Page): """Blog detail page.""" custom_title = models.CharField( max_length=100, blank=False, null=False, help_text='Overwrites the default title', ) blog_image = models.ForeignKey( "wagtailimages.Image", blank=False, null=True, related_name="+", on_delete=models.SET_NULL, ) content = StreamField( [ ("title_and_text", blocks.TitleAndTextBlock()), ("full_richtext", blocks.RichtextBlock()), ("simple_richtext", blocks.SimpleRichtextBlock()), ], null=True, blank=True, ) content_panels = Page.content_panels + [ FieldPanel("custom_title"), ImageChooserPanel("blog_image"), StreamFieldPanel("content"), ]
class ArticleListingPage(RoutablePageMixin, Page): """Article listing page""" template = "article/article_page.html" content = StreamField( [ ("full_richtext", blocks.RichtextBlock()), ], null=True, blank=True, ) subtitle = models.CharField(max_length=100, null=True, blank=True) content_panels = Page.content_panels + [ FieldPanel("subtitle"), StreamFieldPanel("content"), ] class Meta: verbose_name = "Article Page" verbose_name_plural = "Article Pages" @route(r"^$", name="collection_view") def collection_view(self, request): """Find blog posts based on a category.""" context = super().get_context(request) # context = self.get_context(request) collection_id = Collection.objects.get(name='articles').id context['documents'] = Document.objects.filter( collection=collection_id) print(context['documents'][0].collection) return render(request, "article/article_page.html", context)
class HomePage(Page): parent_page_types = ["wagtailcore.Page"] max_count = 1 standard = StreamField([ ("title_and_text", blocks.TitleAndTextBlock()), ("richtext", blocks.RichtextBlock()), ("simplerichtext", blocks.SimpleRichtextBlock()), ("buttons", blocks.ButtonBlock()), ], null=True, blank=True) sections = StreamField([ ("cards", blocks.CardBlock()), ("products", blocks.ProductCardBlock()), ("cta", blocks.CTABlock()), ], null=True, blank=True) content_panels = Page.content_panels + [ StreamFieldPanel("standard"), StreamFieldPanel("sections"), ] api_fields = [ APIField("standard"), APIField("sections"), ]
class BlogDetailPage(Page): """Detail blog articles""" custom_title = models.CharField( max_length=100, blank=False, null=False, help_text="Custom title from blog detail page") blog_image = models.ForeignKey("wagtailimages.Image", blank=False, null=True, help_text="Blog article image", related_name="+", on_delete=models.SET_NULL) content = StreamField( [ ("title_and_text", blocks.TitleAndTextBlock()), ("full_richtext", blocks.RichtextBlock()), ("simple_richtext", blocks.SimpleRichtextBlock()), ("cards", blocks.CardBlock()), ("cta", blocks.CTABlock()), ], null=True, blank=True, ) content_panels = Page.content_panels + [ FieldPanel("custom_title"), ImageChooserPanel("blog_image"), StreamFieldPanel("content"), ]
class BlogDetailPage(Page): """Blog detail page""" custom_title = models.CharField(max_length=100, blank=False, null=False, help_text='Overwrites the default title') blog_image = models.ForeignKey('wagtailimages.Image', blank=False, null=True, related_name='+', on_delete=models.SET_NULL) content = StreamField([ ('title_and_text', blocks.TitleAndTextBlock()), ('full_richtext', blocks.RichtextBlock()), ('simple_richtext', blocks.SimpleRichtextBlock()), ('cards', blocks.CardBlock()), ('cta', blocks.CTABlock()), ], null=True, blank=True) content_panels = Page.content_panels + [ FieldPanel('custom_title'), ImageChooserPanel('blog_image'), StreamFieldPanel('content'), ]
class FlexPage(Page): """Flexible page class""" template = 'flex/flex_page.html' content = StreamField([ ("title_and_text", blocks.TitleAndTextBlock()), ("RichText_Tool", blocks.RichtextBlock()), ("Simple_RichText_Tool", blocks.SimpleRichtextBlock()), ("Cards", blocks.CardBlock()), ("Call_to_action", blocks.CTABlock()), ("Button_Url", blocks.ButtonBlock()), ], null=True, blank=True) subtitle = models.CharField(max_length=100, blank=True, null=True) content_panels = Page.content_panels + [ FieldPanel('subtitle'), StreamFieldPanel('content'), ] class Meta: # noqa verbose_name = "Flex Page" verbose_name_plural = "Flex Pages"
class FlexPage(Page): """Flexibile page class.""" template = "flex/flex_page.html" subpage_types = ['flex.FlexPage', 'contact.ContactPage'] flex_image = models.ForeignKey( "wagtailimages.Image", null=True, blank=True, on_delete=models.SET_NULL, related_name="+", ) parent_page_types = [ 'flex.FlexPage', 'home.HomePage', ] content = StreamField( [ ("title", blocks.HeaderTitleBlock()), ("title_and_text", blocks.TitleAndTextBlock()), ("image", blocks.ImageBlock()), ("full_richtext", blocks.RichtextBlock()), ("simple_richtext", blocks.SimpleRichtextBlock()), ("cards", blocks.CardBlock()), ("cta", blocks.CTABlock()), ("button", blocks.ButtonBlock()), ("simple_card", blocks.SimpleCardBlock()), ("carousel", blocks.CarouselBlock()), ("char_block", streamfield_blocks.CharBlock( required=True, help_text='Oh wow this is help text!!', min_length=10, max_length=50, template="streams/char_block.html", )), ("simple_column", ColumnBlock()), ('two_columns', TwoColumnBlock()), ], null=True, blank=True, ) subtitle = models.CharField(max_length=100, null=True, blank=True) content_panels = Page.content_panels + [ FieldPanel("subtitle"), ImageChooserPanel("flex_image"), StreamFieldPanel("content"), ] class Meta: # noqa verbose_name = "Flex Page" verbose_name_plural = "Flex Pages"
class FlexPage(Page): """Flexible Page Class""" template = "flex/flexpage.html" banner_title = models.CharField(max_length=100, blank=False, null=True) banner_subtitle = RichTextField(features=["bold", "italic"], null=True, blank=True) banner_image = models.ForeignKey( "wagtailimages.Image", null=True, blank=True, on_delete=models.SET_NULL, related_name="+", ) banner_cta = models.ForeignKey( "wagtailcore.Page", null=True, blank=True, on_delete=models.SET_NULL, related_name="+", ) content = StreamField( [ ("title_and_text", blocks.TitleAndTextBlock()), ("full_richtext", blocks.RichtextBlock()), ("simple_richtext", blocks.SimpleRichtextBlock()), ("cards", blocks.CardBlock()), ("cta", blocks.CTABlock()), ], null=True, blank=True, ) subtitle = models.CharField(max_length=100, null=True, blank=True) content_panels = Page.content_panels + [ FieldPanel("subtitle"), MultiFieldPanel( [ FieldPanel("banner_title"), FieldPanel("banner_subtitle"), ImageChooserPanel("banner_image"), PageChooserPanel("banner_cta"), ], heading="Banner Options", ), StreamFieldPanel("content"), ] class Meta: #noqa verbose_name = "Flex Page" verbose_name_plural = "Flex Pages"
class FlexPage(Page): template = "flex/flex_page.html" content = StreamField([("title_and_text", blocks.TitleAndTextBlock()), ("full_richtext", blocks.RichtextBlock()), ("cards", blocks.CardBlock())], null=True, blank=True) subtitle = models.CharField(max_length=100, null=True, blank=True) content_panels = Page.content_panels + [ FieldPanel("subtitle"), StreamFieldPanel("content"), ]
class BlogDetailPage(Page): """Parental blog detail page.""" custom_title = models.CharField( max_length=100, blank=False, null=False, help_text='Overwrites the default title', ) banner_image = models.ForeignKey( "wagtailimages.Image", blank=False, null=True, related_name="+", on_delete=models.SET_NULL, ) categories = ParentalManyToManyField("blog.BlogCategory", blank=True) content = StreamField( [ ("title_and_text", blocks.TitleAndTextBlock()), ("full_richtext", blocks.RichtextBlock()), ("simple_richtext", blocks.SimpleRichtextBlock()), ("cards", blocks.CardBlock()), ("cta", blocks.CTABlock()), ], null=True, blank=True, ) content_panels = Page.content_panels + [ FieldPanel("custom_title"), ImageChooserPanel("banner_image"), MultiFieldPanel( [ InlinePanel("blog_authors", label="Author", min_num=1, max_num=4) ], heading="Author(s)" ), MultiFieldPanel( [ FieldPanel("categories", widget=forms.CheckboxSelectMultiple) ], heading="Categories" ), StreamFieldPanel("content"), ]
class NewsStoryPage(Page): """News story page model""" subpage_types = [] parent_page_types = ['news.NewsIndexPage'] search_fields = Page.search_fields + [index.SearchField('excerpt')] lead_image = models.ForeignKey( "wagtailimages.Image", blank=True, null=True, related_name="+", on_delete=models.SET_NULL, ) excerpt = models.TextField(max_length=300, blank=True, null=True) body = StreamField( [ ("richtext", blocks.RichtextBlock(group="Format and Text")), ("two_column_block", blocks.ColumnsBlock(group="Format and Text")), ("info_box_block", blocks.InfoBoxBlock(group="Format and Text")), ("footnote_block", blocks.FootnoteBlock(group="Format and Text")), ("image_block", blocks.ImageBlock(group="Layout and Images")), ("fellows_block", blocks.FellowsBlock(group="Layout and Images")), ("clear_block", blocks.ClearBlock(group="Layout and Images")), ], null=True, blank=True, ) story_date = models.DateField( default=timezone.now, help_text= 'Defaults to date page was created. If you plan to publish in the future post, change to publish date here.' ) content_panels = Page.content_panels + [ ImageChooserPanel("lead_image"), FieldPanel("excerpt"), StreamFieldPanel("body"), FieldPanel('story_date'), ] class Meta: verbose_name = "News Story" verbose_name_plural = "News Stories"
class BlogDetailPage(Page): """ Blog detail page""" custom_title = models.CharField(max_length=120, blank=False, null=False, help_text='Overwrites the default title') banner_image = models.ForeignKey("wagtailimages.Image", blank=False, null=True, related_name='+', on_delete=models.SET_NULL) content = StreamField([ ("title_and_text", blocks.TitleAndTextBlock()), ("RichText_Tool", blocks.RichtextBlock()), ("Simple_RichText_Tool", blocks.SimpleRichtextBlock()), ("Cards", blocks.CardBlock()), ("Call_to_action", blocks.CTABlock()), ], null=True, blank=True) categories = ParentalManyToManyField("blog.BlogCategory", blank=True) content_panels = Page.content_panels + [ FieldPanel('custom_title'), ImageChooserPanel('banner_image'), MultiFieldPanel([ InlinePanel('blog_authors', label="Author", min_num=1, max_num=4) ], heading="Author(s)"), MultiFieldPanel( [FieldPanel('categories', widget=forms.CheckboxSelectMultiple)], heading="Categories"), StreamFieldPanel('content'), ] # Update Cache when something is update def save(self, *args, **kwargs): key = make_template_fragment_key('post_cache_test', [self.id]) cache.delete(key) return super().save(*args, **kwargs)
class HomePage(Page): """Home page model""" template = "home/home_page.html" max_count = 1 parent_page_type = ['wagtailcore.Page'] body = StreamField( [ ("richtext", blocks.RichtextBlock()), ("page_callout", blocks.PageCallout()), ("webfeed", blocks.WebFeedBlock()), ("new_row", blocks.NewRow()), ], null=True, blank=True, ) content_panels = Page.content_panels + [ MultiFieldPanel( [InlinePanel("carousel_images", max_num=3, label="Image")], heading="Carousel Images", ), StreamFieldPanel("body"), ] # News Feed def get_context(self, request): context = super(HomePage, self).get_context(request) context["news_feed"] = self.news_feed() return context def news_feed(self): # Order by most recent date first news_feed = NewsStoryPage.objects.live().public().order_by( '-story_date')[:3] return news_feed class Meta: verbose_name = "Home Page" verbose_name_plural = "Home Pages"
class WorkshopDetailPage(Page): """Workshop detail page.""" template = "workshop/workshop_detail_page.html" custom_title = models.CharField( max_length=100, blank=False, null=False, help_text='Overwrites the default title', ) description = RichTextField( features=['h2', 'h3', 'bold', 'italic', 'link'], null=True, blank=False) # objectives= RichTextField(features=['h2', 'h3', 'bold', 'italic', 'link'],null=True,blank=True) # datetime = blocks.DateTimeBlock(default=date.today) # models.DateTimeBlock("required=True") blog_image = models.ForeignKey( "wagtailimages.Image", blank=False, null=True, related_name="+", on_delete=models.SET_NULL, ) content = StreamField( [ ("title_and_text", blocks.TitleAndTextBlock()), ("full_richtext", blocks.RichtextBlock()), ("simple_richtext", blocks.SimpleRichtextBlock()), ], null=True, blank=True, ) content_panels = Page.content_panels + [ FieldPanel("custom_title"), ImageChooserPanel("blog_image"), StreamFieldPanel("content"), FieldPanel("description"), # FieldPanel("objectives"), ]
class HomePage(Page): """Home page model.""" template = "home/home_page.html" max_count = 1 body = StreamField( [ ("full_richtext", blocks.RichtextBlock()), ("simple_richtext", blocks.SimpleRichtextBlock()), ("cards", blocks.CardBlock()), ("cta", blocks.CTABlock()), ], null=True, blank=True, ) banner_title = models.CharField(max_length=100, blank=True, null=True) banner_subtitle = RichTextField(blank=True, features=["bold", "italic"]) banner_image = models.ForeignKey("wagtailimages.Image", null=True, blank=True, on_delete=models.SET_NULL, related_name="+") banner_cta = models.ForeignKey("wagtailcore.Page", null=True, blank=True, on_delete=models.SET_NULL, related_name="+") content_panels = Page.content_panels + [ FieldPanel("banner_title"), FieldPanel("banner_subtitle"), ImageChooserPanel("banner_image"), PageChooserPanel("banner_cta"), StreamFieldPanel('body'), ] class Meta: verbose_name = "Home Page" verbose_name_plural = "Home Pages"
class BlogDetailPage(Page): """blog detail page.""" custom_title = models.CharField( max_length=100, blank=False, null=False, help_text='Overwrites the default title', ) content = StreamField([("title_and_text", blocks.TitleAndTextBlock()), ("full_richtext", blocks.RichtextBlock()), ("simple_richtext", blocks.SimpleRichtextBlock()), ("cards", blocks.CardBlock())], null=True, blank=True) content_panels = Page.content_panels + [ FieldPanel("custom_title"), StreamFieldPanel("content"), ]