예제 #1
0
class HomePage(Page):
    templates = "home/hompage_page.html"
    banner_title = models.CharField(max_length = 100, blank = False, null = True)
    banner_subtitle = RichTextField(features = ["bold", "italic", "center"], 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([("cta", blocks.CTABlock())], null=True, blank=True)
    
    content = StreamField(
        [
            ("title_and_text", blocks.TitleAndTextBlock()),
            ("full_richtext", blocks.RichtextBlock()),
            ("simple_richtext", blocks.SimpleRichtextBlock()),
            ("cards", blocks.CardBlock()),
            ("cta", blocks.CTABlock()),
        ],
        default="",
        blank=True,
    )
    
    content_panels = Page.content_panels + [
        MultiFieldPanel(
            [
                FieldPanel("banner_title"),
                FieldPanel("banner_subtitle"),
                ImageChooserPanel("banner_image"),
                PageChooserPanel("banner_cta"),
                StreamFieldPanel("content"),
            ],
            heading="Banner Options",
        
        ),
       
    ]
    
    class Meta:
        verbose_name = "Home Page"
        verbose_name_plural = "Home Pages"
예제 #2
0
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"),
    ]
예제 #3
0
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"
예제 #4
0
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"
예제 #5
0
파일: models.py 프로젝트: sourav-14/WAGTAIL
class FlexPage(Page):

    template = "flex/flex_page.html"

    parent_page_types = [
        'flex.Flexpage',
        'home.HomePage',
    ]
    subpage_types = [
        'flex.FlexPage',
        'contact.ContactPage',
    ]
    subtitle = models.CharField(max_length=100, null=True, blank=True)

    content = StreamField(
        [
            ("title_and_text", blocks.TitleAndTextBlock()),
            ("full_richtext", blocks.RichTextBlock()),
            ("cards", blocks.CardBLock()),
            ("cta", blocks.CTABlock()),
            ("button_block", blocks.ButtonBlock()),
        ],
        null=True,
        blank=True,
    )

    content_panels = Page.content_panels + [
        FieldPanel("subtitle"),
        StreamFieldPanel("content")
    ]

    class Meta:
        verbose_name = "Flex Page"
        verbose_name_plural = "flex pages"
예제 #6
0
class HomePage(Page):
    """This will be the main page"""
    template = 'home/home_page.html'
    max_count = 1

    main_page_title = models.CharField(max_length=400, blank=False, null=True)
    main_page_subtitle = RichTextField(features=["bold", "italic"])
    main_page_background_image = models.ForeignKey("wagtailimages.Image",
                                                   null=True,
                                                   blank=False,
                                                   on_delete=models.SET_NULL,
                                                   related_name="+")
    card_cta = models.ForeignKey("wagtailcore.Page",
                                 null=True,
                                 blank=True,
                                 on_delete=models.SET_NULL,
                                 related_name="+")
    content = StreamField([
        ("service_cards", blocks.ServiceCardBlock()),
        ("cta", blocks.CTABlock()),
    ],
                          null=True,
                          blank=True)
    content_panels = Page.content_panels + [
        FieldPanel("main_page_title"),
        FieldPanel("main_page_subtitle"),
        ImageChooserPanel("main_page_background_image"),
        PageChooserPanel("card_cta"),
        StreamFieldPanel("content"),
    ]

    class Meta:

        verbose_name = "Home Page"
        verbose_name_plural = "Home Pages"
예제 #7
0
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"
예제 #8
0
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"),
    ]
예제 #9
0
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"
예제 #10
0
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'),
    ]
예제 #11
0
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"
예제 #12
0
class BlogDetailPage(Page):
    """Blog detail page."""

    template = "blog/blog_detail_page.html"

    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_rich_text", blocks.RichTextBlock()),
        ("simple_richtext", blocks.SimpleRichTextBlock()),
        ("cards", blocks.CardBlock()),
        ("call_to_action", blocks.CTABlock()),
    ],
                          null=True,
                          blank=True)

    content_panels = Page.content_panels + [
        FieldPanel('custom_title'),
        ImageChooserPanel('blog_image'),
        StreamFieldPanel("content")
    ]
예제 #13
0
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"),
	]
예제 #14
0
class FlexPage(Page):
    """flexbile page class"""

    template = "flex/flex_page.html"
    parent_page_types = ['flex.FlexPage', 'home.HomePage']
    subpage_types = ['flex.FlexPage']

    subtitle = models.CharField(max_length=100, null=True, blank=True)

    content = StreamField(
        [
            ("title_and_text", blocks.TitleAndTextBlock()),
            ("full_richtext", blocks.RichTextBlock()),
            ("simple_richtext", blocks.SimpleRichTextBlock()),
            # ("simple_richtext", blocks.SimpleRichTextBlock(features=["bold", "italic"])),
            ("cards", blocks.CardBlock()),
            ("cta", blocks.CTABlock()),
            ("button", blocks.ButtonBlock()),
        ],
        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"
예제 #15
0
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'),
    ]
예제 #16
0
파일: models.py 프로젝트: eximius8/kaf
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"),
    ]
예제 #17
0
파일: models.py 프로젝트: melzreal/melfolio
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"
예제 #18
0
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)
예제 #19
0
class BlogDetailPage(Page):
    """Parental blog detail page."""

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

    # author = models.ForeignKey(User, on_delete=models.CASCADE, related_name="posts", null=True, blank=True)

    custom_title = models.CharField(
        max_length=100,
        blank=False,
        null=False,
        help_text='Overwrites the default title',
        # verbose_name="タイトル"
    )
    banner_image = models.ForeignKey(
        "wagtailimages.Image",
        blank=False,
        null=True,
        related_name="+",
        on_delete=models.SET_NULL,
    )
    image_alt = models.CharField(
        max_length=100,
        blank=True,
        null=True,
        help_text='Add some alt text',
    )

    categories = ParentalManyToManyField("blog.BlogCategory",
                                         blank=True,
                                         related_name="posts")
    tags = ClusterTaggableManager(through=BlogPageTag, blank=True)

    content = StreamField(
        [
            ("title_and_text", blocks.TitleAndTextBlock()),
            ("full_richtext", blocks.RichTextBlock()),
            ("simple_richtext", blocks.SimpleRichTextBlock()),
            # ("simple_richtext", blocks.SimpleRichTextBlock(features=["bold", "italic"])),
            ("cards", blocks.CardBlock()),
            ("cta", blocks.CTABlock()),
        ],
        null=True,
        blank=True)

    content_panels = Page.content_panels + [
        FieldPanel("custom_title"),
        ImageChooserPanel("banner_image"),
        FieldPanel("image_alt", heading="Image Alt (Option)"),
        MultiFieldPanel([
            InlinePanel("blog_authors", label="Author", min_num=1, max_num=4)
        ],
                        heading="Author(s)"),
        FieldPanel("categories", widget=forms.CheckboxSelectMultiple),
        FieldPanel("tags"),
        StreamFieldPanel("content"),
    ]
예제 #20
0
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='Add your 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()),
        ('cards', blocks.CardBlock()),
        ('cta', blocks.CTABlock()),
    ],
                          null=True,
                          blank=True)

    content_panels = Page.content_panels + [
        FieldPanel('custom_title'),
        FieldPanel("tags"),
        ImageChooserPanel('banner_image'),
        StreamFieldPanel('content'),
        MultiFieldPanel([
            InlinePanel('blog_authors', label='Author', min_num=1, max_num=4)
        ],
                        heading='Authors'),
        MultiFieldPanel(
            [FieldPanel('categories', widget=forms.CheckboxSelectMultiple)],
            heading='Categories'),
    ]

    api_fields = [
        APIField('blog_authors'),
        APIField('content'),
    ]

    def save(self, *args, **kwargs):
        key = make_template_fragment_key('blog_post_preview', [self.id])
        cache.delete(key)
        return super().save(*args, **kwargs)
예제 #21
0
파일: models.py 프로젝트: sourav-14/WAGTAIL
class BlogDetailPage(Page):

    template = "blog/blog_detail.html"
    subpage_types =[]
    parent_page_types = ['blog.BlogListingPage']

    custom_title = models.CharField(
        max_length = 100,
        blank = True,
        null = True,
        help_text = 'Overwrites the default title'
    )
    blog_image = models.ForeignKey(
        "wagtailimages.Image",
        blank = False,
        null = True,
        related_name ='+',
        on_delete = models.SET_NULL,
    )

    categories = ParentalManyToManyField("blog.BlogCategory")
    
    content = StreamField(
        [
            ("title_and_text",blocks.TitleAndTextBlock()),
            ("full_richtext",blocks.RichTextBlock()),
            ("cards",blocks.CardBLock()),
            ("cta",blocks.CTABlock()),
        ],
        null =True,
        blank=True,
    )

    content_panels = Page.content_panels + [
        FieldPanel("custom_title"),
        ImageChooserPanel("blog_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"),

    ]
예제 #22
0
class HomePage(RoutablePageMixin, Page):
    # """Hom Page Model"""

    template = "home/home_page.html"
    max_count = 1
    banner_title = models.CharField(max_length=100, blank=False, null=True)
    banner_subtitle = RichTextField(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 + [
        MultiFieldPanel(
            {
                FieldPanel("banner_title"),
                FieldPanel("banner_subtitle"),
                ImageChooserPanel("banner_image"),
                PageChooserPanel("banner_cta"),
            },
            heading="Banner Options"),
        StreamFieldPanel("content"),
        # MultiFieldPanel([
        #     InlinePanel("carousel_images", max_num=5, min_num=1, label="Image"),
        #
        # ], heading="Carousel Images")
    ]

    content = StreamField([
        ("cta", blocks.CTABlock()),
    ],
                          null=True,
                          blank=True)

    class Meta:

        verbose_name = "Home Page"
        verbose_name_plural = "Home Pages"

    @route(r'^subscribe/$')
    def the_subscribe_page(self, request, *args, **kwargs):
        context = self.get_context(request, *args, **kwargs)
        return render(request, "home/subscribe.html", context)
        pass
예제 #23
0
class HomePage(RoutablePageMixin, Page):
    """Home page model"""

    # You can be explicit with where the template is stored
    template = "home/home_page.html"
    # Max count is how many of this type of pages I can have - e.g. only one home page
    max_count = 1

    banner_title = models.CharField(max_length=100, blank=False, null=True)
    banner_subtitle = RichTextField(features=["bold", "italic"])
    banner_image = models.ForeignKey(
        "wagtailimages.Image",
        null=True,  # the page already exists so this is the default value
        blank=False,  # The field cannot be blank
        on_delete=models.
        SET_NULL,  # When image is deleted, we don't want anything else to be deleted
        related_name="+",  # Not using a related name
    )
    banner_cta = models.ForeignKey(
        "wagtailcore.Page",  # Wagtailcore is app name and page is class name
        null=True,
        blank=True,
        on_delete=models.SET_NULL,
        related_name="+",
    )

    content = StreamField([("cta", blocks.CTABlock())], null=True, blank=True)

    content_panels = Page.content_panels + [
        MultiFieldPanel([
            FieldPanel("banner_title"),
            FieldPanel("banner_subtitle"),
            ImageChooserPanel("banner_image"),
            PageChooserPanel("banner_cta"),
        ],
                        heading="Banner Options"),
        MultiFieldPanel([
            InlinePanel("carousel_images", max_num=5, min_num=1,
                        label="Image"),
        ],
                        heading="Carousel Images"),
        StreamFieldPanel("content"),
    ]

    class Meta:
        verbose_name = "Home Page"
        verbose_name_plural = "Home pages"

    # Routable page which lives on the home page
    @route(r'^subscribe/$')
    def the_subscribe_page(self, request, *args, **kwargs):
        context = self.get_context(request, *args, **kwargs)
        context['test'] = "hello world 123"
        return render(request, "home/subscribe.html", context)
예제 #24
0
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"
예제 #25
0
class MyblogDetailPage(Page):
    """Blog detail page"""
    
    template = "myblog/myblog_detail_page.html"
    
    custom_title = models.CharField(
            max_length=100,
            blank=False,
            null=False,
            help_text="Overwrites default title"        
        )
    
    blog_image = models.ForeignKey(
        "wagtailimages.Image",
        blank=False,
        null=True,        
        on_delete=models.SET_NULL,
        related_name="+"
        )
    
    categories = ParentalManyToManyField("myblog.MyBlogCategory", blank=True)
    
    content = StreamField(
        [
                ("title_and_text", blocks.TitleAndTextBlock()),
                ("rich_text", blocks.RichTextBlock()),
                ("simple_text", blocks.SimpleTextBlock()),
                ("cards", blocks.CardBlock()),
                ("cta", blocks.CTABlock())
        ],
        null=True,
        blank=True
        )
    
    content_panels = Page.content_panels + [
            FieldPanel("custom_title"),
            ImageChooserPanel("blog_image"),            
            MultiFieldPanel(
                [
                        InlinePanel("blog_authors", label="Author", min_num=1, max_num=5)
                ],
                heading="Author(s)"
            ),
            MultiFieldPanel(
                [
                    FieldPanel("categories", widget=forms.CheckboxSelectMultiple),
                ],
                heading="categories"                                    
            ),
            StreamFieldPanel("content"), 
        ]
    
예제 #26
0
class HomePage(Page):
    """Home page model."""

    template = "home/home_page.html"
    max_count = 1

    banner_title = models.CharField(max_length=100, blank=False, null=True)
    banner_subtitle = RichTextField(features=["bold", "italic"])
    banner_image = models.ForeignKey("wagtailimages.Image",
                                     null=True,
                                     blank=False,
                                     on_delete=models.SET_NULL,
                                     related_name="+")

    content = StreamField(
        [
            ("cta", blocks.CTABlock()),
        ],
        null=True,
        blank=True,
    )
    banner_cta = models.ForeignKey("wagtailcore.Page",
                                   null=True,
                                   blank=True,
                                   on_delete=models.SET_NULL,
                                   related_name="+")

    content_panels = Page.content_panels + [
        MultiFieldPanel(
            [
                FieldPanel("banner_title"),
                FieldPanel("banner_subtitle"),
                ImageChooserPanel("banner_image"),
                PageChooserPanel("banner_cta"),
            ],
            heading="Banner Options",
        ),
        MultiFieldPanel(
            [
                InlinePanel(
                    "carousel_images", max_num=5, min_num=1, label="Image")
            ],
            heading="Carousel Images",
        ),
        StreamFieldPanel("content"),
    ]

    class Meta:

        verbose_name = "Home Page"
        verbose_name_plural = "Home Pages"
예제 #27
0
class BlogDetailPage(Page):
    """Parental Blog Detail Page."""

    custom_title = models.CharField(
        max_length=100,
        blank=False,
        null=False,
        help_text="Overwrites the default title",
    )

    description = RichTextField(features=[], blank=True, null=True)

    banner_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,
    )

    categories = ParentalManyToManyField("blog.BlogCategory", blank=True)

    content_panels = Page.content_panels + [
        FieldPanel("custom_title"),
        ImageChooserPanel("banner_image"),
        FieldPanel("description"),
        MultiFieldPanel(
            [
                InlinePanel(
                    "blog_authors", label="Author", min_num=1, max_num=10
                )
            ],
            heading="Author(s)",
        ),
        MultiFieldPanel(
            [FieldPanel("categories", widget=forms.CheckboxSelectMultiple)],
            heading="Categories",
        ),
        StreamFieldPanel("content"),
    ]
예제 #28
0
class HomePage(RoutablePageMixin, Page):
    """Home page model"""

    templates = "templates/home/home_page.html"
    max_count = 1
    banner_title = models.CharField(max_length=100, blank=False, null=True)
    banner_subtitle = RichTextField(features=['bold', 'italic'])
    banner_image = models.ForeignKey(
        'wagtailimages.Image',
        null=True,
        blank=False,
        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(
        [
            ('cta', blocks.CTABlock()),
        ],
        null=True,
        blank=True
    )
    content_panels = Page.content_panels + [
        MultiFieldPanel([
            FieldPanel('banner_title'),
            FieldPanel('banner_subtitle'),
            ImageChooserPanel('banner_image'),
            PageChooserPanel('banner_cta'),
        ], heading='Banner Options'),

        MultiFieldPanel([
            InlinePanel('carousel_images', max_num=5, min_num=1, label='Image'),
        ], heading='Carousel Images'),

        StreamFieldPanel('content'),

    ]
    class Meta:
        verbose_name = "Home Page"
        verbose_name_plural = "Home Pages"

    @route(r'^subscribe/$')
    def the_subscribe_page(self, request, *args, **kwargs):
        context = self.get_context(request, *args, **kwargs)
        return render(request, "home/subscribe.html", context)
예제 #29
0
class BlogDetailPage(Page):

    subpage_types = []
    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"),
        StreamFieldPanel("content"),
        MultiFieldPanel(
            [
                InlinePanel("blog_authors", label="Author", min_num=0, max_num=4)
            ],
            heading="Author(s)"
        ),
        MultiFieldPanel(
            [
               FieldPanel("categories", widget=forms.CheckboxSelectMultiple) 
            ],
            heading="Categories"
        ),
    ]
예제 #30
0
class HomePageCarouselImages(Orderable):
    """Between one and five images for the homepage carousel"""

    page = ParentalKey("home.HomePage", related_name="carousel_images")
    carousel_image = models.ForeignKey(
        "wagtailimages.Image",
        null=True,  # the page already exists so this is the default value
        blank=False,  # The field cannot be blank
        on_delete=models.
        SET_NULL,  # When image is deleted, we don't want anything else to be deleted
        related_name="+",  # Not using a related name
    )
    carousel_title = models.CharField(null=True, blank=True, max_length=100)
    carousel_text = models.CharField(null=True, blank=True, max_length=250)

    content = StreamField([("cta", blocks.CTABlock())], null=True, blank=True)

    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,
    )

    panels = [
        ImageChooserPanel("carousel_image"),
        FieldPanel("carousel_title"),
        FieldPanel("carousel_text"),
        StreamFieldPanel("content"),
    ]