summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Graham <timograham@gmail.com>2012-09-30 13:37:25 -0400
committerTim Graham <timograham@gmail.com>2012-09-30 13:37:57 -0400
commitd0345b71146ecb60af2277585b604fbc244d267b (patch)
treee088aa991ae465ba3ddc8ce38c5076a766f9cac4
parentd5a4f209c3889a76a23a19f3212ab2d7b5c62e1c (diff)
Fixed #15338 - Documented django.utils.decorators
-rw-r--r--docs/ref/utils.txt31
1 files changed, 31 insertions, 0 deletions
diff --git a/docs/ref/utils.txt b/docs/ref/utils.txt
index de19578cac..bd3898172a 100644
--- a/docs/ref/utils.txt
+++ b/docs/ref/utils.txt
@@ -170,6 +170,37 @@ The functions defined in this module share the following properties:
``tzinfo`` attribute is a :class:`~django.utils.tzinfo.FixedOffset`
instance.
+``django.utils.decorators``
+===========================
+
+.. module:: django.utils.decorators
+ :synopsis: Functions that help with creating decorators for views.
+
+.. function:: method_decorator(decorator)
+
+ Converts a function decorator into a method decorator. See :ref:`decorating
+ class based views<decorating-class-based-views>` for example usage.
+
+.. function:: decorator_from_middleware(middleware_class)
+
+ Given a middleware class, returns a view decorator. This lets you use
+ middleware functionality on a per-view basis. The middleware is created
+ with no params passed.
+
+.. function:: decorator_from_middleware_with_args(middleware_class)
+
+ Like ``decorator_from_middleware``, but returns a function
+ that accepts the arguments to be passed to the middleware_class.
+ For example, the :func:`~django.views.decorators.cache.cache_page`
+ decorator is created from the
+ :class:`~django.middleware.cache.CacheMiddleware` like this::
+
+ cache_page = decorator_from_middleware_with_args(CacheMiddleware)
+
+ @cache_page(3600)
+ def my_view(request):
+ pass
+
``django.utils.encoding``
=========================