wagtail-factories 0.3.0
pip install wagtail-factories==0.3.0
Newer version available (4.2.1)
Released:
Factory boy classes for wagtail
Navigation
Verified details
These details have been verified by PyPIOwner
Maintainers
Unverified details
These details have not been verified by PyPIProject links
Meta
- License: MIT License (MIT)
- Author: Michael van Tellingen
Classifiers
- Development Status
- License
- Programming Language
Project description
Factory boy classes for Wagtail CMS
Installation
pip install wagtail-factories
Usage
Documentation is still in progress, but see the tests for more examples.
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
Project details
Verified details
These details have been verified by PyPIOwner
Maintainers
Unverified details
These details have not been verified by PyPIProject links
Meta
- License: MIT License (MIT)
- Author: Michael van Tellingen
Classifiers
- Development Status
- License
- Programming Language
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file wagtail_factories-0.3.0.tar.gz
.
File metadata
- Download URL: wagtail_factories-0.3.0.tar.gz
- Upload date:
- Size: 3.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ecc9a31aeece1e9875b61a5249d009187f5d16355ebb5a3fca718df85e7392ef |
|
MD5 | 778114c4439cb40e55dbcb68c97ee812 |
|
BLAKE2b-256 | f6010844bd815ad5b9b38788b1d7bfe6c0163f5b2ed613a28e42bdad0b8df8a4 |
File details
Details for the file wagtail_factories-0.3.0-py2.py3-none-any.whl
.
File metadata
- Download URL: wagtail_factories-0.3.0-py2.py3-none-any.whl
- Upload date:
- Size: 5.9 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 903149c28ed40bd18b13fba1b364c9aff23004fc98ed4c26531fbeb927ec866c |
|
MD5 | 75de288c07617d6343d77ec09ecf11d7 |
|
BLAKE2b-256 | f24b7d1247d523241a2eccd21fd604ed7d6697a8a61043c82360aa68b8197e88 |