diff --git a/docs/ref/contrib/flatpages.txt b/docs/ref/contrib/flatpages.txt index 01e5553ff3..074c637d6b 100644 --- a/docs/ref/contrib/flatpages.txt +++ b/docs/ref/contrib/flatpages.txt @@ -216,15 +216,11 @@ registering a custom ``ModelAdmin`` for ``FlatPage``:: Via the Python API ------------------ -.. class:: FlatPage - Flatpages are represented by a standard :doc:`Django model `, which lives in :source:`django/contrib/flatpages/models.py`. You can access flatpage objects via the :doc:`Django database API `. -.. currentmodule:: django.contrib.flatpages - .. admonition:: Check for duplicate flatpage URLs. 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 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 `). + :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 ` + for a detailed explanation. + + .. attribute:: template_name + + Optional (:attr:`blank=True `). 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 ==================