diff options
Diffstat (limited to 'docs/flatpages.txt')
| -rw-r--r-- | docs/flatpages.txt | 37 |
1 files changed, 19 insertions, 18 deletions
diff --git a/docs/flatpages.txt b/docs/flatpages.txt index 21416079e9..73b5653c6b 100644 --- a/docs/flatpages.txt +++ b/docs/flatpages.txt @@ -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_flatpages`` and ``django_flatpages_sites``. ``django_flatpages`` is a -simple lookup table that essentially maps a URL to a title and bunch of text -content. ``django_flatpages_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 @@ -49,7 +50,7 @@ If it finds a match, it follows this algorithm: * If the flatpage has a custom template, it loads that template. Otherwise, it loads the template ``flatpages/default``. * It passes that template a single context variable, ``flatpage``, which is - the flatpage object. It uses DjangoContext_ in rendering the template. + the flatpage object. It uses RequestContext_ in rendering the template. If it doesn't find a match, the request continues to be processed as usual. @@ -63,7 +64,7 @@ resort. For more on middleware, read the `middleware docs`_. .. _SITE_ID: http://www.djangoproject.com/documentation/settings/#site-id -.. _DjangoContext: http://www.djangoproject.com/documentation/templates_python/#subclassing-context-djangocontext +.. _RequestContext: http://www.djangoproject.com/documentation/templates_python/#subclassing-context-djangocontext .. _middleware docs: http://www.djangoproject.com/documentation/middleware/ How to add, change and delete flatpages @@ -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"> |
