Two new assertions have been added: `assertAllowedSubpageTypes` and
`assertAllowedParentPageTypes`. They both take a Page class, and a set
of Page classes, and compares the allowed subpage / parent page models
for the Page class to the set passed in.
`wagtail.tests.utils.WagtailPageTests` is a new `TestCase` subclass that
helps developers write tests for their Wagtail sites. It currently
includes three assert methods:
`assertCanCreateAt(parent_model, child_model)`, which asserts that a
child page of a certain type could be created underneath a parent page.
This is useful for making assertions around the business rules of your
site.
`assertCanNotCreateAt(parent_model, child_model)` is the inverse of the
above.
`assertCanCreate(parent, child_model, data)` asserts that a child page
can be added underneath the given parent page, by POSTing `data` at the
correct page in the Wagtail admin. This checks that the developer has
correctly configured their `content_panels` and related options.
These methods are just a start, and could be expanded further. More
methods could be added, asserting that Snippets can be created, for
example. The current methods could be extended further, to validate more
about the Wagtail admin page editor.
Previously, if a developer wanted to use a custom Manager on their Page
subclass, some fairly hacky hacks were required. Now, the `objects`
attribute is only overridden if it is a plain `Manager`. If it is
anything else, it is left alone. A system check has been added to ensure
that all `Page` managers inherit from `PageManager`
There's no reason not to (the default `<wagtail.wagtailcore.blocks.base.BoundBlock object at 0xb5b1348c>` representation is pretty useless), and doing it this way makes the explanation of BoundBlock much easier - we don't have to explain the render() method or single out children of StreamBlock as a special case that doesn't need it.
Django 1.8 only as it's too tricky to implement for Django 1.7. Django 1.7 users will still be able to index reverse relations, just indexing speed may be much slower.
Django 1.9 requires this line before importing any models. Autodoc
imported models to get their docstrings, causing errors in the build
process.
Fixes #2014.