class FlexPage(Page): 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()), ], default="", 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 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 FlexPage(Page): """Flexibile page class.""" template = "flex/flex_page.html" # @todo add streamfields content = StreamField( [ ("title_and_text", blocks.TitleAndTextBlock()), ("full_richtext", blocks.RichtextBlock()), ("simple_richtext", blocks.SimpleRichtextBlock()), ], 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 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 PostPage(Page): """Model for page with a post""" template = 'blog/post_page.html' subpage_types = [] subtitle = models.CharField(max_length=200, null=True, blank=True) image = models.ForeignKey( "wagtailimages.Image", blank=True, null=True, related_name="+", on_delete=models.SET_NULL, ) content = StreamField( [ ("description", blocks.SimpleRichtextBlock()), ("ctablock", blocks.CTABlock()), ("cardblock", blocks.CardBlock()), ], null=True, blank=True, ) categories = ParentalManyToManyField("blog.BlogCategory", blank=True) content_panels = Page.content_panels + [ FieldPanel("subtitle"), MultiFieldPanel([ FieldPanel("categories", widget=forms.CheckboxSelectMultiple), ]), ImageChooserPanel("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()), ], 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()), ("full_richtext", blocks.RichtextBlock()), ("simple_richtext", blocks.SimpleRichtextBlock()), ("cards", blocks.CardBlock()), ("cta", blocks.CTABlock()), ("button", blocks.ButtonBlock()), ], blank=True, null=True, ) subtitle = models.CharField(max_length=100, blank=True, null=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 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 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): """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()), ], 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): """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 HomePage(Page): templates = "home/hompage_page.html" carousel_images = StreamField(blocks.CarouselBlock(max_num=3, required=False), blank=True, null=True) content = StreamField( [ ('team', blocks.TeamCards()), ('image', blocks.ImageBlock()), ("jumbotron", blocks.ActionAreaBlock()), ("title_and_text", blocks.TitleAndTextBlock()), ("simple_richtext", blocks.SimpleRichtextBlock()), ("cards", blocks.CardBlock()), ("cta", blocks.CTABlock()), ], null=True, blank=True, ) content_panels = Page.content_panels + [ StreamFieldPanel("carousel_images"), StreamFieldPanel("content"), ] 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') 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 StandardPage(Page): """Standard page class.""" template = "standard/standard_page.html" # @todo add streamfields content = StreamField( [ ("title_and_text", blocks.TitleAndTextBlock()), ("simple_richtext", blocks.SimpleRichtextBlock()), ], 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 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): """Flexibile 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()), ("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 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): """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 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 FlexPage(Page): """Flexible Page Class""" template = "flex/flexpage.html" banner_overlay = ColorField(blank=True, verbose_name='Banner Overlay Color', help_text='Select color of banner overlay', null=True) banner_image = models.ForeignKey( "wagtailimages.Image", null=True, blank=True, on_delete=models.SET_NULL, related_name="+", ) content = StreamField( [ ('team', blocks.TeamCards()), ('image', blocks.ImageBlock()), ("jumbotron", blocks.ActionAreaBlock()), ("title_and_text", blocks.TitleAndTextBlock()), ("simple_richtext", blocks.SimpleRichtextBlock()), ("cards", blocks.CardBlock()), ], null=True, blank=True, ) content_panels = Page.content_panels + [ MultiFieldPanel( [ NativeColorPanel("banner_overlay"), ImageChooserPanel("banner_image"), ], heading="Banner Options", ), StreamFieldPanel("content"), ] class Meta: verbose_name = "Flex Page" verbose_name_plural = "Flex Pages"
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 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"), ]
class BlogDetailPage(Page): """Blog detail page.""" date_composed = models.DateField(default=date.today, verbose_name="Composition Date") custom_title = models.CharField( max_length=100, blank=False, null=False, help_text='Overwrites the default title', ) summary = RichTextField( blank=True, null=True, help_text="Teaser text will show on the blog listing page") blog_image = models.ForeignKey( "wagtailimages.Image", blank=True, 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("date_composed"), FieldPanel("custom_title"), FieldPanel("summary"), ImageChooserPanel("blog_image"), StreamFieldPanel("content"), ]
class KbPage(Page): date = models.DateField("Post date") intro = models.CharField(max_length=250) # body = RichTextField(blank=True) # stream field for multiple body elements content = StreamField( [ ("title_and_text", blocks.TitleAndTextBlock()), ("full_richtext", blocks.RichtextBlock()), ("simple_richtext", blocks.SimpleRichtextBlock()), ], null=True, blank=True, ) def main_image(self): gallery_item = self.gallery_images.first() if gallery_item: return gallery_item.image else: return None search_fields = Page.search_fields + [ index.SearchField('intro'), index.SearchField('content'), index.SearchField('main_image'), index.SearchField('title'), ] content_panels = Page.content_panels + [ FieldPanel('date'), FieldPanel('intro'), InlinePanel('gallery_images', label="Gallery images"), InlinePanel('documents', label="Documents"), # FieldPanel('body', classname="full"), StreamFieldPanel("content"), ]
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()), ("full_richtext", blocks.RichtextBlock()), ("simple_richtext", blocks.SimpleRichtextBlock()), ("cards", blocks.CardBlock()), ("img_text", blocks.ImgText()), ("image", blocks.ImageBlock()), ("text_img", blocks.TextImg()), ("cta", blocks.CTABlock()), ("button", blocks.ButtonBlock()), ("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", ))], 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 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()), ("testimonials", blocks.TestimonialBlock()), ("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 HomePage(Page): """Home page model.""" template = "home/home_page.html" max_count = 1 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, ) banner_title = models.CharField(max_length=100, blank=False, null=True) banner_subtitle = RichTextField( features=["bold", "italic", "h2", "h3", "h4"]) banner_image = models.ForeignKey("wagtailimages.Image", null=True, blank=False, on_delete=models.SET_NULL, related_name="+") content_panels = Page.content_panels + [ FieldPanel("banner_title"), FieldPanel("banner_subtitle"), ImageChooserPanel("banner_image"), StreamFieldPanel("content"), ] class Meta: verbose_name = "Home Page" verbose_name_plural = "Home Pages"