All Projects → wagtail → Wagtail Factories

wagtail / Wagtail Factories

Licence: mit
Factory boy classes for wagtail

Programming Languages

python
139335 projects - #7 most used programming language

Labels

Projects that are alternatives of or similar to Wagtail Factories

wagtail.io
Source code of https://wagtail.org/
Stars: ✭ 25 (-56.9%)
Mutual labels:  wagtail
wagtailsvg
Wagtail + SVG
Stars: ✭ 26 (-55.17%)
Mutual labels:  wagtail
Coderedcms
A content management system for marketing websites based on Django and Wagtail.
Stars: ✭ 386 (+565.52%)
Mutual labels:  wagtail
wagtailvideos
Videos for Wagtail CMS, including transcoding
Stars: ✭ 43 (-25.86%)
Mutual labels:  wagtail
draftjs-conductor
📝✨ Little Draft.js helpers to make rich text editors “just work”
Stars: ✭ 39 (-32.76%)
Mutual labels:  wagtail
Wagtail Bootstrap Blog
Wagtail blog based on Bootstrap 4, support Markdown, Latex and user comments.
Stars: ✭ 273 (+370.69%)
Mutual labels:  wagtail
wagtail-2fa
2 Factor Authentication for Wagtail
Stars: ✭ 63 (+8.62%)
Mutual labels:  wagtail
Bakerydemo
Next generation Wagtail demo, born in Reykjavik
Stars: ✭ 468 (+706.9%)
Mutual labels:  wagtail
wagtail-react-streamfield
Powerful field for inserting multiple blocks with nesting. (NO LONGER MAINTAINED - See Wagtail 2.13 Release Notes)
Stars: ✭ 75 (+29.31%)
Mutual labels:  wagtail
Wagtaildemo
Old example site implemented with Wagtail. Please see https://github.com/wagtail/bakerydemo for the current demo site
Stars: ✭ 285 (+391.38%)
Mutual labels:  wagtail
wagtailclearstream
A work-in-progress app to make Wagtail's StreamField more modular
Stars: ✭ 33 (-43.1%)
Mutual labels:  wagtail
madewithwagtail
A showcase of sites and apps made with Wagtail CMS, the easy to use, open source Django content management system
Stars: ✭ 69 (+18.97%)
Mutual labels:  wagtail
Wagtailmenus
An app to help you manage and render menus in your Wagtail projects more effectively
Stars: ✭ 275 (+374.14%)
Mutual labels:  wagtail
devheldev
Our development site with Wagtail
Stars: ✭ 14 (-75.86%)
Mutual labels:  wagtail
Draftail
📝🍸 A configurable rich text editor built with Draft.js
Stars: ✭ 413 (+612.07%)
Mutual labels:  wagtail
wagtail-react-blog
SPA built with React, Tailwind CSS and Wagtail Rest API
Stars: ✭ 66 (+13.79%)
Mutual labels:  wagtail
wagtail-whoosh
Search backend for Wagtail CMS using Whoosh engine.
Stars: ✭ 23 (-60.34%)
Mutual labels:  wagtail
Ls.joyous
A calendar application for Wagtail
Stars: ✭ 53 (-8.62%)
Mutual labels:  wagtail
Puput
A Django blog app implemented in Wagtail
Stars: ✭ 450 (+675.86%)
Mutual labels:  wagtail
Longclaw
A shop for Wagtail CMS
Stars: ✭ 278 (+379.31%)
Mutual labels:  wagtail

================= wagtail-factories

Factory boy classes for Wagtail CMS

.. start-no-pypi

Status

.. image:: https://readthedocs.org/projects/wagtail-factories/badge/?version=latest :target: https://readthedocs.org/projects/wagtail-factories/

.. image:: https://github.com/wagtail/wagtail-factories/workflows/Python%20Tests/badge.svg :target: https://github.com/wagtail/wagtail-factories/actions?query=workflow%3A%22Python+Tests%22

.. image:: https://img.shields.io/pypi/v/wagtail-factories.svg :target: https://pypi.python.org/pypi/wagtail-factories/

.. end-no-pypi

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/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')
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].