示例#1
0
 def setUp(self):
     super().setUp()
     # Create Blog
     self.blog_page = BlogPageFactory(body=[
         ("heading", "Test heading 1"),
         ("paragraph", RichText("This is a paragraph.")),
         ("heading", "Test heading 2"),
         ("image", wagtail_factories.ImageFactory()),
         ("decimal", decimal.Decimal(1.2)),
         ("date", datetime.date.today()),
         ("datetime", datetime.datetime.now()),
         (
             "carousel",
             StreamValue(
                 stream_block=CarouselBlock(),
                 stream_data=[
                     ("image",
                      wagtail_factories.ImageChooserBlockFactory()),
                     ("image",
                      wagtail_factories.ImageChooserBlockFactory()),
                 ],
             ),
         ),
         (
             "gallery",
             {
                 "title":
                 "Gallery title",
                 "images":
                 StreamValue(
                     stream_block=ImageGalleryImages(),
                     stream_data=[
                         (
                             "image",
                             {
                                 "image":
                                 wagtail_factories.ImageChooserBlockFactory(
                                 )
                             },
                         ),
                         (
                             "image",
                             {
                                 "image":
                                 wagtail_factories.ImageChooserBlockFactory(
                                 )
                             },
                         ),
                     ],
                 ),
             },
         ),
         ("objectives", ["Read all of article!"]),
         ("video", {
             "youtube_link": EmbedValue("https://youtube.com/")
         }),
     ])
示例#2
0
    def setUp(self):
        super().setUp()

        # Create Blog
        self.blog_page = BlogPageFactory(
            body=[
                ("heading", "Test heading 1"),
                ("paragraph", RichText("This is a paragraph.")),
                ("heading", "Test heading 2"),
                ("image", wagtail_factories.ImageFactory()),
                ("decimal", decimal.Decimal(1.2)),
                ("date", datetime.date.today()),
                ("datetime", datetime.datetime.now()),
                (
                    "carousel",
                    StreamValue(
                        stream_block=CarouselBlock(),
                        stream_data=[
                            ("image",
                             wagtail_factories.ImageChooserBlockFactory()),
                            ("image",
                             wagtail_factories.ImageChooserBlockFactory()),
                        ],
                    ),
                ),
                (
                    "gallery",
                    {
                        "title":
                        "Gallery title",
                        "images":
                        StreamValue(
                            stream_block=ImageGalleryImages(),
                            stream_data=[
                                (
                                    "image",
                                    {
                                        "image":
                                        wagtail_factories.
                                        ImageChooserBlockFactory()
                                    },
                                ),
                                (
                                    "image",
                                    {
                                        "image":
                                        wagtail_factories.
                                        ImageChooserBlockFactory()
                                    },
                                ),
                            ],
                        ),
                    },
                ),
                ("callout", {
                    "text": RichText("<p>Hello, World</p>")
                }),
                ("objectives", ["Read all of article!"]),
                (
                    "video",
                    {
                        "youtube_link":
                        EmbedValue(
                            "https://www.youtube.com/watch?v=_U79Wc965vw")
                    },
                ),
                (
                    "text_and_buttons",
                    {
                        "text":
                        "Button text",
                        "buttons": [{
                            "button_text": "btn",
                            "button_link": "https://www.graphql.com/",
                        }],
                        "mainbutton": {
                            "button_text": "Take me to the source",
                            "button_link": "https://wagtail.io/",
                        },
                    },
                ),
                ("text_with_callable", TextWithCallableBlockFactory()),
            ],
            parent=self.home,
        )