From 6d6863c01d5aaedfe3a57fa793d2378efa7d76f6 Mon Sep 17 00:00:00 2001 From: Karl Hobley Date: Mon, 18 May 2015 15:17:27 +0100 Subject: [PATCH] Link to routablepage from "adding endpoints to pages" docs --- docs/reference/contrib/routablepage.rst | 2 ++ docs/reference/pages/model_recipes.rst | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/docs/reference/contrib/routablepage.rst b/docs/reference/contrib/routablepage.rst index 59f049fff1..4e50f90ea6 100644 --- a/docs/reference/contrib/routablepage.rst +++ b/docs/reference/contrib/routablepage.rst @@ -4,6 +4,8 @@ ``RoutablePageMixin`` ===================== +.. module:: wagtail.contrib.wagtailroutablepage + The ``RoutablePageMixin`` mixin provides a convenient way for a page to respond on multiple sub-URLs with different views. For example, a blog section on a site might provide several different types of index page at URLs like ``/blog/2013/06/``, ``/blog/authors/bob/``, ``/blog/tagged/python/``, all served by the same page instance. A ``Page`` using ``RoutablePageMixin`` exists within the page tree like any other page, but URL paths underneath it are checked against a list of patterns. If none of the patterns match, control is passed to subpages as usual (or failing that, a 404 error is thrown). diff --git a/docs/reference/pages/model_recipes.rst b/docs/reference/pages/model_recipes.rst index e78f9b4b21..f6ce25f929 100644 --- a/docs/reference/pages/model_recipes.rst +++ b/docs/reference/pages/model_recipes.rst @@ -43,6 +43,10 @@ With this strategy, you could use Django or Python utilities to render your mode Adding Endpoints with Custom :meth:`~wagtail.wagtailcore.models.Page.route` Methods ----------------------------------------------------------------------------------- +.. note:: + + A much simpler way of adding more endpoints to pages is provided by the :mod:`~wagtail.contrib.wagtailroutablepage` module. + Wagtail routes requests by iterating over the path components (separated with a forward slash ``/``), finding matching objects based on their slug, and delegating further routing to that object's model class. The Wagtail source is very instructive in figuring out what's happening. This is the default ``route()`` method of the ``Page`` class: .. code-block:: python