mirror of
https://github.com/Hopiu/wagtail.git
synced 2026-05-04 05:24:45 +00:00
Link to routablepage from "adding endpoints to pages" docs
This commit is contained in:
parent
29cd935dc3
commit
6d6863c01d
2 changed files with 6 additions and 0 deletions
|
|
@ -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).
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in a new issue