kopia lustrzana https://github.com/wagtail/wagtail
Update page.rst
Added parent_page_types docs and updated subpage_types docs to include instructions on blocking child page creation altogether.pull/1017/head
rodzic
e342ad5580
commit
08a5ac9b36
|
@ -53,6 +53,29 @@ In addition to the model fields provided, ``Page`` has many properties and metho
|
|||
class BlogIndex(Page):
|
||||
subpage_types = ['mysite.BlogPage', 'mysite.BlogArchivePage']
|
||||
|
||||
The creation of child pages can be blocked altogether for a given page by setting it's subpage_types attribute to an empty array e.g
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
class BlogPage(Page):
|
||||
subpage_types = []
|
||||
|
||||
.. attribute:: parent_page_types
|
||||
|
||||
A whitelist of page models which are allowed as parent page types e.g a ``BlogPage`` may only allow itself to be created below the ``BlogIndex`` page e.g
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
class BlogPage(Page):
|
||||
parent_page_types = ['mysite.BlogIndexPage']
|
||||
|
||||
Pages can block themselves from being created at all by setting parent_page_types to an empty array (this is useful for creating unique pages that should only be created once) e.g
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
class HiddenPage(Page):
|
||||
parent_page_types = []
|
||||
|
||||
.. attribute:: password_required_template
|
||||
|
||||
Defines which template file should be used to render the login form for Protected pages using this model. This overrides the default, defined using ``PASSWORD_REQUIRED_TEMPLATE`` in your settings. See :ref:`private_pages`
|
||||
|
|
Ładowanie…
Reference in New Issue