Skip to main content

Wagtail Foliage

CircleCI

Utilities for programmatically building page trees in Wagtail for automated tests, default site structures, and more.

Requirements

Wagtail Foliage supports:

  • Python 3.4, 3.5, 3.6, and 3.7
  • Django 1.11, 2.0, and 2.1
  • Wagtail 1.13, 2.3, and 2.4

These are the currently supported versions for each project as of December 2018, excepting the exclusion of Python 2.7 from this list.

Installation

pip install wagtail-foliage

Usage

Use as a context manager

from django.db import TestCase
from foliage.contextmanagers import page_tree

from myapp.models import HomePage, InsidePage


class MyAppTestCase(TestCase):
    def test_with_pages(self):
        PAGES = [
            (HomePage(title='Home Page'), [
                InsidePage(title='Inside Page'),
                (InsidePage(title='Inside Page With Children'), [
                    InsidePage(title='Third Level Page'),
                    InsidePage(title='Another Third Level Page')
                ])
            ])
        ]
        with page_tree(PAGES):
            # Tests that rely on that page tree go here. The context manager
            # will automatically set the top level page as the Wagtail site's
            # root page

Use as a decorator

from django.db import TestCase
from foliage.contextmanagers import page_tree

from myapp.models import HomePage, InsidePage


PAGES = [
    (HomePage(title='Home Page'), [
        InsidePage(title='Inside Page'),
        (InsidePage(title='Inside Page With Children'), [
            InsidePage(title='Third Level Page'),
            InsidePage(title='Another Third Level Page')
        ])
    ])
]


class MyAppTestCase(TestCase):
    @page_tree(PAGES)
    def test_with_pages(self):
        # Tests that rely on that page tree go here. The context manager
        # will automatically set the top level page as the Wagtail site's
        # root page

Use the low-level API

from foliage.utils import build_page_tree

from myapp.models import HomePage, InsidePage

new_pages = build_page_tree([
    (HomePage(title='Home Page'), [
        InsidePage(title='Inside Page'),
        (InsidePage(title='Inside Page With Children'), [
            InsidePage(title='Third Level Page'),
            InsidePage(title='Another Third Level Page')
        ])
    ])
])

Metadata

Release files for wagtail-foliage 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for wagtail-foliage 0.1.1
File Size Uploaded Provenance
wagtail-foliage-0.1.1.tar.gz 6.5 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for wagtail-foliage 0.1.1
File Interpreter ABI Platform
wagtail_foliage-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 16.0 kB

Release files / wagtail-foliage-0.1.1.tar.gz

Download URL wagtail-foliage-0.1.1.tar.gz
Size 6.5 kB
Tags Source
SHA-256 checksum
How to use checksums
56aeed96fae21409a1c882b0127131e010fba724414f9a5cbc5a40a91ed34d33
BLAKE2b-256 checksum
How to use checksums
c8525d99db80efa26052459fed0aedaee2a745f33eda557b53407882a8fcec63
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.12.1 pkginfo/1.4.2 requests/2.21.0 setuptools/40.6.3 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.7.0

Release files / wagtail_foliage-0.1.1-py3-none-any.whl

Download URL wagtail_foliage-0.1.1-py3-none-any.whl
Size 9.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
027b0551b6f979b0c9ecf14d63c44b4932c56297ac931612e6f59b8ed5f60f3d
BLAKE2b-256 checksum
How to use checksums
25016b9dd630f8aa12a06af3dc7620ebff124551346adb803b3eb9dd042549fd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.12.1 pkginfo/1.4.2 requests/2.21.0 setuptools/40.6.3 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.7.0

Security for wagtail-foliage 0.1.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page