mirror of
https://github.com/django/django.git
synced 2025-07-04 17:59:13 +00:00
magic-removal: Proofread docs/flatpages.txt
git-svn-id: http://code.djangoproject.com/svn/django/branches/magic-removal@2764 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
9327788e25
commit
3db13442a1
@ -3,7 +3,8 @@ The flatpages app
|
||||
=================
|
||||
|
||||
Django comes with an optional "flatpages" application. It lets you store simple
|
||||
"flat" HTML content in a database and handles the management for you.
|
||||
"flat" HTML content in a database and handles the management for you via
|
||||
Django's admin interface and a Python API.
|
||||
|
||||
A flatpage is a simple object with a URL, title and content. Use it for
|
||||
one-off, special-case pages, such as "About" or "Privacy Policy" pages, that
|
||||
@ -23,10 +24,10 @@ Installation
|
||||
|
||||
To install the flatpages app, follow these steps:
|
||||
|
||||
1. Add ``"django.contrib.flatpages"`` to your INSTALLED_APPS_ setting.
|
||||
2. Add ``"django.contrib.flatpages.middleware.FlatpageFallbackMiddleware"``
|
||||
1. Add ``'django.contrib.flatpages'`` to your INSTALLED_APPS_ setting.
|
||||
2. Add ``'django.contrib.flatpages.middleware.FlatpageFallbackMiddleware'``
|
||||
to your MIDDLEWARE_CLASSES_ setting.
|
||||
3. Run the command ``django-admin.py install flatpages``.
|
||||
3. Run the command ``manage.py syncdb``.
|
||||
|
||||
.. _INSTALLED_APPS: http://www.djangoproject.com/documentation/settings/#installed-apps
|
||||
.. _MIDDLEWARE_CLASSES: http://www.djangoproject.com/documentation/settings/#middleware-classes
|
||||
@ -34,10 +35,10 @@ To install the flatpages app, follow these steps:
|
||||
How it works
|
||||
============
|
||||
|
||||
``django-admin.py install flatpages`` creates two tables in your database:
|
||||
``django_flatpage`` and ``django_flatpage_sites``. ``django_flatpage`` is a
|
||||
simple lookup table that essentially maps a URL to a title and bunch of text
|
||||
content. ``django_flatpage_sites`` associates a flatpage with a site.
|
||||
``manage.py syncdb`` creates two tables in your database: ``django_flatpage``
|
||||
and ``django_flatpage_sites``. ``django_flatpage`` is a simple lookup table
|
||||
that simply maps a URL to a title and bunch of text content.
|
||||
``django_flatpage_sites`` associates a flatpage with a site.
|
||||
|
||||
The ``FlatpageFallbackMiddleware`` does all of the work. Each time any Django
|
||||
application raises a 404 error, this middleware checks the flatpages database
|
||||
@ -80,8 +81,8 @@ Via the Python API
|
||||
------------------
|
||||
|
||||
Flatpages are represented by a standard `Django model`_, which lives in
|
||||
`django/contrib/flatpages/models/flatpages.py`_. You can access flatpage
|
||||
objects via the `Django database API`_.
|
||||
`django/contrib/flatpages/models.py`_. You can access flatpage objects via the
|
||||
`Django database API`_.
|
||||
|
||||
.. _Django model: http://www.djangoproject.com/documentation/model_api/
|
||||
.. _django/contrib/flatpages/models/flatpages.py: http://code.djangoproject.com/browser/django/trunk/django/contrib/flatpages/models/flatpages.py
|
||||
@ -90,17 +91,17 @@ objects via the `Django database API`_.
|
||||
Flatpage templates
|
||||
==================
|
||||
|
||||
By default, flatpages are rendered via the template ``flatpages/default``, but
|
||||
you can override that for a particular flatpage.
|
||||
By default, flatpages are rendered via the template ``flatpages/default.html``,
|
||||
but you can override that for a particular flatpage.
|
||||
|
||||
Creating the ``flatpages/default`` template is your responsibility; in your
|
||||
template directory, just create a ``flatpages`` directory containing a file
|
||||
``default.html``.
|
||||
Creating the ``flatpages/default.html`` template is your responsibility; in
|
||||
your template directory, just create a ``flatpages`` directory containing a
|
||||
file ``default.html``.
|
||||
|
||||
Flatpage templates are passed a single context variable, ``flatpage``, which is
|
||||
the flatpage object.
|
||||
|
||||
Here's a sample ``flatpages/default`` template::
|
||||
Here's a sample ``flatpages/default.html`` template::
|
||||
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"
|
||||
"http://www.w3.org/TR/REC-html40/loose.dtd">
|
||||
|
Loading…
x
Reference in New Issue
Block a user