コード例 #1
0
class MyTestPageWithStreamFieldFactory(wagtail_factories.PageFactory):

    body = wagtail_factories.StreamFieldFactory({
        'char_array':
        wagtail_factories.ListBlockFactory(wagtail_factories.CharBlockFactory),
        'int_array':
        wagtail_factories.ListBlockFactory(
            wagtail_factories.IntegerBlockFactory),
        'struct':
        MyBlockFactory,
        'image':
        wagtail_factories.ImageChooserBlockFactory
    })

    class Meta:
        model = models.MyTestPage
コード例 #2
0
class MyTestPageWithStreamFieldFactory(wagtail_factories.PageFactory):

    body = wagtail_factories.StreamFieldFactory({
        "char_array":
        wagtail_factories.ListBlockFactory(wagtail_factories.CharBlockFactory),
        "int_array":
        wagtail_factories.ListBlockFactory(
            wagtail_factories.IntegerBlockFactory),
        "struct":
        MyBlockFactory,
        "image":
        wagtail_factories.ImageChooserBlockFactory,
    })

    class Meta:
        model = models.MyTestPage
コード例 #3
0
class MyBlockFactory(wagtail_factories.StructBlockFactory):
    title = "my title"
    item = factory.SubFactory(MyBlockItemFactory)
    items = wagtail_factories.ListBlockFactory(MyBlockItemFactory)
    image = factory.SubFactory(wagtail_factories.ImageChooserBlockFactory)

    class Meta:
        model = models.MyBlock
コード例 #4
0
class SearchBlockFactory(wagtail_factories.StructBlockFactory):
    filters = wagtail_factories.ListBlockFactory(_FilterItemFactory)
    tags = []

    class Meta:
        model = SearchBlock
コード例 #5
0
class TilesBlockFactory(wagtail_factories.StructBlockFactory):
    images = wagtail_factories.ListBlockFactory(_ServiceItemFactory)

    class Meta:
        model = TilesBlock