feincms/feincms — pull request #413 by DrMeers (2013-04-29 05:37:43+00:00)
Title: Template upgrades

This is still largely in-progress, and lacking docs and tests, but already very useful (and in use in production sites already). I wanted to draw your attention to it sooner rather than later in case I get too busy and it grows stale/outdated.

The biggest change is the concept of a 'singleton' template -- a template which should only be used once on a site, which is a pattern I find exists on most projects. A 'home' template, or a 'contact' template, or a 'fancy-blah-index' template. Such pages you often want to allow users to move around and edit, but not delete, add other, etc. You also want to be able to easily and robustly reverse the URLs for such pages, and plug application content into them. One of the next features I plan to add is automatic application-content addition/reversal within singleton templates rather than having to add one-off content types in the admin.

There are also some subtler features, such as the concept 'child templates'. For example, I've regularly build 'news-index' pages, for example, whose child templates automatically become 'news-indexes' themselves. If you define 'news-index' as a singleton, with a child template of 'news-item', new children automatically adopt the appropriate template.

The 'enforce-leaf' functionality is also handy -- sometimes, usually in the case of pages with fancy ApplicationContent or dynamic templates, your page should really be a "dead-end" as far as the page hierarchy is concerned, and its only children are hooked in via ApplicationContent, etc.

As far as I can tell all changes so far should be 100% backwards compatible and safe to merge in already.