Metadata-Version: 2.1
Name: wagtail_factories
Version: 2.1.0
Summary: Factory boy classes for wagtail
Home-page: https://github.com/wagtail/wagtail-factories/
Author: Michael van Tellingen
Author-email: michaelvantellingen@gmail.com
License: MIT
Description: =================
        wagtail-factories
        =================
        
        Factory boy classes for Wagtail CMS
        
        
        
        
        
        Installation
        ============
        
        .. code-block:: shell
        
           pip install wagtail-factories
        
        
        
        Usage
        =====
        
        Documentation is still in progress, but see the `tests`_ for more examples.
        
        .. _tests: https://github.com/wagtail/wagtail-factories/tree/main/tests
        
        .. code-block:: python
        
            import wagtail_factories
            from . import models
        
        
            class MyCarouselItemFactory(wagtail_factories.StructBlockFactory):
                label = 'my-label'
                image = factory.SubFactory(
                    wagtail_factories.ImageChooserBlockFactory)
        
                class Meta:
                    model = models.MyBlockItem
        
        
            class MyCarouselFactory(wagtail_factories.StructBlockFactory):
                title = "Carousel title"
                items = wagtail_factories.ListBlockFactory(
                    MyCarouselItemFactory)
        
                class Meta:
                    model = models.MyCarousel
        
        
            class MyTestPageFactory(wagtail_factories.PageFactory):
        
                body = wagtail_factories.StreamFieldFactory({
                    'carousel': MyCarouselFactory
                })
        
                class Meta:
                    model = models.MyTestPage
        
        
            def test_my_page():
                root_page = wagtail_factories.PageFactory(parent=None)
                my_page = MyTestPageFactory(
                    parent=root_page,
                    body__0__carousel__items__0__label='Slide 1',
                    body__0__carousel__items__0__image__image__title='Image Slide 1',
                    body__0__carousel__items__1__label='Slide 2',
                    body__0__carousel__items__1__image__image__title='Image Slide 2',
                    body__0__carousel__items__2__label='Slide 3',
                    body__0__carousel__items__2__image__image__title='Image Slide 3')
        
Platform: UNKNOWN
Classifier: Development Status :: 5 - Production/Stable
Classifier: License :: OSI Approved :: MIT License
Classifier: Intended Audience :: Developers
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: Implementation :: CPython
Classifier: Programming Language :: Python :: Implementation :: PyPy
Classifier: Framework :: Django
Classifier: Framework :: Django :: 3.2
Classifier: Framework :: Django :: 4.0
Classifier: Framework :: Wagtail
Classifier: Framework :: Wagtail :: 2
Classifier: Framework :: Wagtail :: 3
Provides-Extra: docs
Provides-Extra: test
