Ticket #14556: 14556-1.diff
File 14556-1.diff, 2.0 KB (added by , 13 years ago) |
---|
-
docs/ref/contrib/flatpages.txt
diff --git a/docs/ref/contrib/flatpages.txt b/docs/ref/contrib/flatpages.txt index 0b20ecc..6856f19 100644
a b To install the flatpages app, follow these steps: 42 42 2. Add ``'django.contrib.flatpages'`` to your :setting:`INSTALLED_APPS` 43 43 setting. 44 44 45 Then either: 46 47 3. Add an entry in your URLconf. For example:: 48 49 urlpatterns = patterns('', 50 ('^pages/', include('django.contrib.flatpages.urls')), 51 ) 52 53 or: 54 45 55 3. Add ``'django.contrib.flatpages.middleware.FlatpageFallbackMiddleware'`` 46 56 to your :setting:`MIDDLEWARE_CLASSES` setting. 47 57 … … and ``django_flatpage_sites``. ``django_flatpage`` is a simple lookup table 57 67 that simply maps a URL to a title and bunch of text content. 58 68 ``django_flatpage_sites`` associates a flatpage with a site. 59 69 70 Using the URLconf 71 ----------------- 72 73 There are several ways to include the flat pages in your URLconf. You can 74 dedicate a particular namespace to flat pages, like:: 75 76 urlpatterns = patterns('', 77 ('^pages/', include('django.contrib.flatpages.urls')), 78 ) 79 80 You can also set it up as a "catchall" pattern. In this case, it is important 81 to place the pattern '''at the end''' of the other urlpatterns:: 82 83 <... your patterns ...> 84 urlpatterns = patterns('django.contrib.flatpages.views', 85 (r'^(?P<url>.*)$', 'flatpage'), 86 ) 87 88 Another common setup is to use flat pages for a limited set of known pages and 89 to hard code the urls, so as to be able to reference them with the url template 90 tag:: 91 92 urlpatterns+= patterns('django.contrib.flatpages.views', 93 url(r'^about-us/$', 'flatpage', {'url': '/about-us/'}, name='about'), 94 url(r'^license/$', 'flatpage', {'url': '/license/'}, name='license'), 95 ) 96 97 Using the middleware 98 -------------------- 99 60 100 The :class:`~django.contrib.flatpages.middleware.FlatpageFallbackMiddleware` 61 doesall of the work.101 can do all of the work. 62 102 63 103 .. class:: FlatpageFallbackMiddleware 64 104