summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorGabriel Hurley <gabehr@gmail.com>2011-02-28 05:26:48 +0000
committerGabriel Hurley <gabehr@gmail.com>2011-02-28 05:26:48 +0000
commit32ac8d913e4074da99fe4588c1d0f959f500cd4a (patch)
treea9a7a010829f3e804311d7c9a952a9bc4c8cb1ea /docs
parentf5c0328fd3f5a965bace09f7aef0ada67751fad5 (diff)
[1.2.X] Fixed #15395 -- Documented the modules/import paths for the various decorators in `django.views.decorators`. Thanks to slinkp for the report.
Backport of [15671] from trunk. git-svn-id: http://code.djangoproject.com/svn/django/branches/releases/1.2.X@15672 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'docs')
-rw-r--r--docs/topics/http/decorators.txt27
1 files changed, 20 insertions, 7 deletions
diff --git a/docs/topics/http/decorators.txt b/docs/topics/http/decorators.txt
index 30883a45e8..09ffecbdf9 100644
--- a/docs/topics/http/decorators.txt
+++ b/docs/topics/http/decorators.txt
@@ -2,7 +2,7 @@
View decorators
===============
-.. currentmodule:: django.views.decorators.http
+.. module:: django.views.decorators.http
Django provides several decorators that can be applied to views to support
various HTTP features.
@@ -10,12 +10,16 @@ various HTTP features.
Allowed HTTP methods
====================
+The following decorators in :mod:`django.views.decorators.http` can be used to
+restrict access to views based on the request method.
+
.. function:: require_http_methods(request_method_list)
-This decorator is used to make a view only accept particular request methods.
-Usage::
+This decorator is used to ensure that a view only accepts particular request
+methods. Usage::
from django.views.decorators.http import require_http_methods
+
@require_http_methods(["GET", "POST"])
def my_view(request):
# I can assume now that only GET or POST requests make it this far
@@ -35,6 +39,9 @@ Decorator to require that a view only accept the POST method.
Conditional view processing
===========================
+The following decorators in :mod:`django.views.decorators.http` can be used to
+control caching behavior on particular views.
+
.. function:: condition(etag_func=None, last_modified_func=None)
.. function:: etag(etag_func)
@@ -45,27 +52,33 @@ These decorators can be used to generate ``ETag`` and ``Last-Modified``
headers; see
:doc:`conditional view processing </topics/conditional-view-processing>`.
-.. currentmodule:: django.views.decorators.http
+.. module:: django.views.decorators.gzip
GZip compression
================
+The decorators in :mod:`django.views.decorators.gzip` control content
+compression on a per-view basis.
+
.. function:: gzip_page()
This decorator compresses content if the browser allows gzip compression.
It sets the ``Vary`` header accordingly, so that caches will base their
storage on the ``Accept-Encoding`` header.
-.. currentmodule:: django.views.decorators.vary
+.. module:: django.views.decorators.vary
Vary headers
============
-The ``Vary`` header defines which request headers a cache mechanism should take
-into account when building its cache key.
+The decorators in :mod:`django.views.decorators.vary` can be used to control
+caching based on specific request headers.
.. function:: vary_on_cookie(func)
.. function:: vary_on_headers(*headers)
+The ``Vary`` header defines which request headers a cache mechanism should take
+into account when building its cache key.
+
See :ref:`using vary headers <using-vary-headers>`.