mirror of
https://github.com/wagtail/wagtail.git
synced 2024-11-29 17:36:49 +01:00
Merge pull request #1480 from kaedroho/model-reference-tweaks
Model reference formatting tweaks
This commit is contained in:
commit
ad25aec535
@ -1,3 +1,4 @@
|
|||||||
|
===============
|
||||||
Model Reference
|
Model Reference
|
||||||
===============
|
===============
|
||||||
|
|
||||||
@ -5,13 +6,13 @@ Model Reference
|
|||||||
|
|
||||||
This document contains reference information for the model classes inside the ``wagtailcore`` module.
|
This document contains reference information for the model classes inside the ``wagtailcore`` module.
|
||||||
|
|
||||||
|
|
||||||
``Page``
|
``Page``
|
||||||
~~~~~~~~
|
========
|
||||||
|
|
||||||
.. autoclass:: Page
|
Database fields
|
||||||
|
~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
**Database fields:**
|
.. class:: Page
|
||||||
|
|
||||||
.. attribute:: title
|
.. attribute:: title
|
||||||
|
|
||||||
@ -79,7 +80,12 @@ This document contains reference information for the model classes inside the ``
|
|||||||
|
|
||||||
This is used by the :meth:`~wagtail.wagtailcore.query.PageQuerySet.in_menu` QuerySet filter.
|
This is used by the :meth:`~wagtail.wagtailcore.query.PageQuerySet.in_menu` QuerySet filter.
|
||||||
|
|
||||||
In addition to the model fields provided, ``Page`` has many properties and methods that you may wish to reference, use, or override in creating your own models. Those listed here are relatively straightforward to use, but consult the Wagtail source code for a full view of what's possible.
|
Methods and properies
|
||||||
|
~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
|
In addition to the model fields provided, ``Page`` has many properties and methods that you may wish to reference, use, or override in creating your own models. Those listed here are relatively straightforward to use, but consult the Wagtail source code for a full view of what's possible.
|
||||||
|
|
||||||
|
.. class:: Page
|
||||||
|
|
||||||
.. autoattribute:: specific
|
.. autoattribute:: specific
|
||||||
|
|
||||||
@ -147,17 +153,17 @@ This document contains reference information for the model classes inside the ``
|
|||||||
|
|
||||||
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`
|
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`
|
||||||
|
|
||||||
|
|
||||||
``Site``
|
``Site``
|
||||||
~~~~~~~~
|
========
|
||||||
|
|
||||||
The ``Site`` model is useful for multi-site installations as it allows an administrator to configure which part of the tree to use for each hostname that the server responds on.
|
The ``Site`` model is useful for multi-site installations as it allows an administrator to configure which part of the tree to use for each hostname that the server responds on.
|
||||||
|
|
||||||
This configuration is used by the :class:`~wagtail.wagtailcore.middleware.SiteMiddleware` middleware class which checks each request against this configuration and appends the Site object to the Django request object.
|
This configuration is used by the :class:`~wagtail.wagtailcore.middleware.SiteMiddleware` middleware class which checks each request against this configuration and appends the Site object to the Django request object.
|
||||||
|
|
||||||
.. autoclass:: Site
|
Database fields
|
||||||
|
~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
**Database fields:**
|
.. class:: Site
|
||||||
|
|
||||||
.. attribute:: hostname
|
.. attribute:: hostname
|
||||||
|
|
||||||
@ -191,7 +197,10 @@ This configuration is used by the :class:`~wagtail.wagtailcore.middleware.SiteMi
|
|||||||
|
|
||||||
The default site is used as a fallback in situations where a site with the required hostname/port couldn't be found.
|
The default site is used as a fallback in situations where a site with the required hostname/port couldn't be found.
|
||||||
|
|
||||||
**Methods and attributes:**
|
Methods and properties
|
||||||
|
~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
|
.. class:: Site
|
||||||
|
|
||||||
.. automethod:: find_for_request
|
.. automethod:: find_for_request
|
||||||
|
|
||||||
@ -208,7 +217,7 @@ This configuration is used by the :class:`~wagtail.wagtailcore.middleware.SiteMi
|
|||||||
.. automethod:: get_site_root_paths
|
.. automethod:: get_site_root_paths
|
||||||
|
|
||||||
``PageRevision``
|
``PageRevision``
|
||||||
~~~~~~~~~~~~~~~~
|
================
|
||||||
|
|
||||||
Every time a page is edited a new ``PageRevision`` is created and saved to the database. It can be used to find the full history of all changes that have been made to a page and it also provides a place for new changes to be kept before going live.
|
Every time a page is edited a new ``PageRevision`` is created and saved to the database. It can be used to find the full history of all changes that have been made to a page and it also provides a place for new changes to be kept before going live.
|
||||||
|
|
||||||
@ -216,10 +225,10 @@ Every time a page is edited a new ``PageRevision`` is created and saved to the d
|
|||||||
- The content of the page is JSON-serialised and stored in the :attr:`~PageRevision.content_json` field
|
- The content of the page is JSON-serialised and stored in the :attr:`~PageRevision.content_json` field
|
||||||
- You can retrieve a ``PageRevision`` as a :class:`~wagtail.wagtailcore.models.Page` object by calling the :meth:`~PageRevision.as_page_object` method
|
- You can retrieve a ``PageRevision`` as a :class:`~wagtail.wagtailcore.models.Page` object by calling the :meth:`~PageRevision.as_page_object` method
|
||||||
|
|
||||||
|
Database fields
|
||||||
|
~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
.. autoclass:: PageRevision
|
.. class:: PageRevision
|
||||||
|
|
||||||
**Database fields:**
|
|
||||||
|
|
||||||
.. attribute:: page
|
.. attribute:: page
|
||||||
|
|
||||||
@ -249,7 +258,10 @@ Every time a page is edited a new ``PageRevision`` is created and saved to the d
|
|||||||
|
|
||||||
This field contains the JSON content for the page at the time the revision was created
|
This field contains the JSON content for the page at the time the revision was created
|
||||||
|
|
||||||
**Managers:**
|
Managers
|
||||||
|
~~~~~~~~
|
||||||
|
|
||||||
|
.. class:: PageRevision
|
||||||
|
|
||||||
.. attribute:: objects
|
.. attribute:: objects
|
||||||
|
|
||||||
@ -271,7 +283,10 @@ Every time a page is edited a new ``PageRevision`` is created and saved to the d
|
|||||||
|
|
||||||
PageRevision.submitted_revisions.all()
|
PageRevision.submitted_revisions.all()
|
||||||
|
|
||||||
**Methods and attributes:**
|
Methods and properties
|
||||||
|
~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
|
.. class:: PageRevision
|
||||||
|
|
||||||
.. automethod:: as_page_object
|
.. automethod:: as_page_object
|
||||||
|
|
||||||
@ -294,11 +309,12 @@ Every time a page is edited a new ``PageRevision`` is created and saved to the d
|
|||||||
Calling this will copy the content of this revision into the live page object. If the page is in draft, it will be published.
|
Calling this will copy the content of this revision into the live page object. If the page is in draft, it will be published.
|
||||||
|
|
||||||
``GroupPagePermission``
|
``GroupPagePermission``
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~
|
=======================
|
||||||
|
|
||||||
.. autoclass:: GroupPagePermission
|
Database fields
|
||||||
|
~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
**Database fields:**
|
.. class:: GroupPagePermission
|
||||||
|
|
||||||
.. attribute:: group
|
.. attribute:: group
|
||||||
|
|
||||||
@ -313,11 +329,12 @@ Every time a page is edited a new ``PageRevision`` is created and saved to the d
|
|||||||
(choice list)
|
(choice list)
|
||||||
|
|
||||||
``PageViewRestriction``
|
``PageViewRestriction``
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~
|
=======================
|
||||||
|
|
||||||
.. autoclass:: PageViewRestriction
|
Database fields
|
||||||
|
~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
**Database fields:**
|
.. class:: PageViewRestriction
|
||||||
|
|
||||||
.. attribute:: page
|
.. attribute:: page
|
||||||
|
|
||||||
@ -328,11 +345,12 @@ Every time a page is edited a new ``PageRevision`` is created and saved to the d
|
|||||||
(text)
|
(text)
|
||||||
|
|
||||||
``Orderable`` (abstract)
|
``Orderable`` (abstract)
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~
|
========================
|
||||||
|
|
||||||
.. autoclass:: Orderable
|
Database fields
|
||||||
|
~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
**Database fields:**
|
.. class:: Orderable
|
||||||
|
|
||||||
.. attribute:: sort_order
|
.. attribute:: sort_order
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user