Metadata-Version: 2.0
Name: wagtail-factories
Version: 0.3.0
Summary: Factory boy classes for wagtail
Home-page: https://github.com/mvantellingen/wagtail-factories/
Author: Michael van Tellingen
Author-email: michaelvantellingen@gmail.com
License: MIT
Platform: UNKNOWN
Classifier: Development Status :: 1 - Planning
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 2
Classifier: Programming Language :: Python :: 2.7
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.3
Classifier: Programming Language :: Python :: 3.4
Classifier: Programming Language :: Python :: 3.5
Classifier: Programming Language :: Python :: Implementation :: CPython
Classifier: Programming Language :: Python :: Implementation :: PyPy
Requires-Dist: factory-boy (>=2.7.0)
Requires-Dist: wagtail (>=1.8)
Provides-Extra: docs
Requires-Dist: sphinx (>=1.4.0); extra == 'docs'
Provides-Extra: test
Requires-Dist: coverage (==4.3.4); extra == 'test'
Requires-Dist: flake8 (==3.3.0); extra == 'test'
Requires-Dist: flake8-blind-except (==0.1.1); extra == 'test'
Requires-Dist: flake8-debugger (==1.4.0); extra == 'test'
Requires-Dist: isort (==4.2.5); extra == 'test'
Requires-Dist: psycopg2 (==2.6.2); extra == 'test'
Requires-Dist: pytest (==3.0.6); extra == 'test'
Requires-Dist: pytest-cov (==2.4.0); extra == 'test'
Requires-Dist: pytest-django (==3.1.2); extra == 'test'
Requires-Dist: pytest-pythonpath (==0.7.1); extra == 'test'

=================
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/mvantellingen/wagtail-factories/tree/master/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')ctories.py for more examples


