torchbox/wagtail — pull request #328 by gasman (2014-06-17 22:45:55+00:00)
Title: Additional UX/workflow niceties when subpage_types is in use

This patch adds some UX/workflow improvements that take effect whenever a Page model specifies a list of page types that are allowable as child pages, via the `subpage_types` property (see #194, #243):

* subpage_types is now validated on the 'create' view, not just on the add_subpage 'choose a page type' view - this stops users from hacking the URL to bypass the page type checks.
* 'Add child page' links do not show for pages that explicitly forbid child pages (by setting `subpage_types` to an empty list). This is done by tweaking the permissions model so that a page with no subpage types is treated equivalently to 'this user does not have permission to add pages here'.
* If a page defines exactly one subpage type (e.g. a NewsIndex that only allows NewsItem pages as children), we redirect straight to the 'create' view for the relevant page type, rather than prompting the user to select it from a list of one item.