Changeset 2764
- Timestamp:
- 04/27/06 23:54:51 (2 years ago)
- Files:
-
- django/branches/magic-removal/docs/flatpages.txt (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
django/branches/magic-removal/docs/flatpages.txt
r2608 r2764 4 4 5 5 Django comes with an optional "flatpages" application. It lets you store simple 6 "flat" HTML content in a database and handles the management for you. 6 "flat" HTML content in a database and handles the management for you via 7 Django's admin interface and a Python API. 7 8 8 9 A flatpage is a simple object with a URL, title and content. Use it for … … 24 25 To install the flatpages app, follow these steps: 25 26 26 1. Add `` "django.contrib.flatpages"`` to your INSTALLED_APPS_ setting.27 2. Add `` "django.contrib.flatpages.middleware.FlatpageFallbackMiddleware"``27 1. Add ``'django.contrib.flatpages'`` to your INSTALLED_APPS_ setting. 28 2. Add ``'django.contrib.flatpages.middleware.FlatpageFallbackMiddleware'`` 28 29 to your MIDDLEWARE_CLASSES_ setting. 29 3. Run the command `` django-admin.py install flatpages``.30 3. Run the command ``manage.py syncdb``. 30 31 31 32 .. _INSTALLED_APPS: http://www.djangoproject.com/documentation/settings/#installed-apps … … 35 36 ============ 36 37 37 `` django-admin.py install flatpages`` creates two tables in your database:38 ``django_flatpage`` and ``django_flatpage_sites``. ``django_flatpage`` is a 39 simple lookup table that essentially maps a URL to a title and bunch of text 40 content.``django_flatpage_sites`` associates a flatpage with a site.38 ``manage.py syncdb`` creates two tables in your database: ``django_flatpage`` 39 and ``django_flatpage_sites``. ``django_flatpage`` is a simple lookup table 40 that simply maps a URL to a title and bunch of text content. 41 ``django_flatpage_sites`` associates a flatpage with a site. 41 42 42 43 The ``FlatpageFallbackMiddleware`` does all of the work. Each time any Django … … 81 82 82 83 Flatpages are represented by a standard `Django model`_, which lives in 83 `django/contrib/flatpages/models /flatpages.py`_. You can access flatpage84 objects via the`Django database API`_.84 `django/contrib/flatpages/models.py`_. You can access flatpage objects via the 85 `Django database API`_. 85 86 86 87 .. _Django model: http://www.djangoproject.com/documentation/model_api/ … … 91 92 ================== 92 93 93 By default, flatpages are rendered via the template ``flatpages/default ``, but94 you can override that for a particular flatpage.94 By default, flatpages are rendered via the template ``flatpages/default.html``, 95 but you can override that for a particular flatpage. 95 96 96 Creating the ``flatpages/default `` template is your responsibility; in your97 template directory, just create a ``flatpages`` directory containing a file 98 ``default.html``.97 Creating the ``flatpages/default.html`` template is your responsibility; in 98 your template directory, just create a ``flatpages`` directory containing a 99 file ``default.html``. 99 100 100 101 Flatpage templates are passed a single context variable, ``flatpage``, which is 101 102 the flatpage object. 102 103 103 Here's a sample ``flatpages/default `` template::104 Here's a sample ``flatpages/default.html`` template:: 104 105 105 106 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"
