mirror of
https://github.com/django/django.git
synced 2024-12-23 01:25:58 +00:00
Added detailed FlatPage model reference
This commit is contained in:
parent
3d819e2324
commit
6c425ddf5a
@ -216,15 +216,11 @@ registering a custom ``ModelAdmin`` for ``FlatPage``::
|
|||||||
Via the Python API
|
Via the Python API
|
||||||
------------------
|
------------------
|
||||||
|
|
||||||
.. class:: FlatPage
|
|
||||||
|
|
||||||
Flatpages are represented by a standard
|
Flatpages are represented by a standard
|
||||||
:doc:`Django model </topics/db/models>`,
|
:doc:`Django model </topics/db/models>`,
|
||||||
which lives in :source:`django/contrib/flatpages/models.py`. You can access
|
which lives in :source:`django/contrib/flatpages/models.py`. You can access
|
||||||
flatpage objects via the :doc:`Django database API </topics/db/queries>`.
|
flatpage objects via the :doc:`Django database API </topics/db/queries>`.
|
||||||
|
|
||||||
.. currentmodule:: django.contrib.flatpages
|
|
||||||
|
|
||||||
.. admonition:: Check for duplicate flatpage URLs.
|
.. admonition:: Check for duplicate flatpage URLs.
|
||||||
|
|
||||||
If you add or modify flatpages via your own code, you will likely want to
|
If you add or modify flatpages via your own code, you will likely want to
|
||||||
@ -233,6 +229,69 @@ Via the Python API
|
|||||||
``django.contrib.flatpages.forms.FlatpageForm`` and used in your own
|
``django.contrib.flatpages.forms.FlatpageForm`` and used in your own
|
||||||
views.
|
views.
|
||||||
|
|
||||||
|
.. currentmodule:: django.contrib.flatpages
|
||||||
|
|
||||||
|
``FlatPage`` model
|
||||||
|
==================
|
||||||
|
|
||||||
|
.. class:: models.FlatPage
|
||||||
|
|
||||||
|
Fields
|
||||||
|
------
|
||||||
|
|
||||||
|
.. class:: models.FlatPage
|
||||||
|
:noindex:
|
||||||
|
|
||||||
|
:class:`~django.contrib.flatpages.models.FlatPage` objects have the
|
||||||
|
following fields:
|
||||||
|
|
||||||
|
.. attribute:: url
|
||||||
|
|
||||||
|
Required. 100 characters or fewer. Indexed for faster lookups.
|
||||||
|
|
||||||
|
.. attribute:: title
|
||||||
|
|
||||||
|
Required. 200 characters or fewer.
|
||||||
|
|
||||||
|
.. attribute:: content
|
||||||
|
|
||||||
|
Optional (:attr:`blank=True <django.db.models.Field.blank>`).
|
||||||
|
:class:`~django.db.models.TextField` that typically, contains
|
||||||
|
the HTML content of the page.
|
||||||
|
|
||||||
|
.. attribute:: enable_comments
|
||||||
|
|
||||||
|
Boolean. This field is not used by :mod:`~django.contrib.flatpages`
|
||||||
|
by default and does not appear in the admin interface. Please see
|
||||||
|
:ref:`flatpages admin interface section <flatpages-admin>`
|
||||||
|
for a detailed explanation.
|
||||||
|
|
||||||
|
.. attribute:: template_name
|
||||||
|
|
||||||
|
Optional (:attr:`blank=True <django.db.models.Field.blank>`). 70
|
||||||
|
characters or fewer. Specifies the template used to render the
|
||||||
|
page. Defaults to :file:`flatpages/default.html` if not provided.
|
||||||
|
|
||||||
|
.. attribute: registration_required
|
||||||
|
|
||||||
|
Boolean. When ``True``, restricts the page access
|
||||||
|
to logged-in users only.
|
||||||
|
|
||||||
|
.. attribute:: sites
|
||||||
|
|
||||||
|
Many-to-many relationship to :class:`~django.contrib.sites.models.Site`
|
||||||
|
|
||||||
|
Methods
|
||||||
|
-------
|
||||||
|
|
||||||
|
.. class:: models.FlatPage
|
||||||
|
:noindex:
|
||||||
|
|
||||||
|
.. method:: get_absolute_url()
|
||||||
|
|
||||||
|
Returns the absolute URL of the page based on the
|
||||||
|
:attr:`~django.contrib.flatpages.models.FlatPage.url` attribute.
|
||||||
|
|
||||||
Flatpage templates
|
Flatpage templates
|
||||||
==================
|
==================
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user