Ticket #15338: 15338.2.diff

File 15338.2.diff, 1.5 KB (added by Tim Graham, 12 years ago)
  • docs/ref/utils.txt

    diff --git a/docs/ref/utils.txt b/docs/ref/utils.txt
    index de19578..bd38981 100644
    a b The functions defined in this module share the following properties:  
    170170    ``tzinfo`` attribute is a :class:`~django.utils.tzinfo.FixedOffset`
    171171    instance.
    172172
     173``django.utils.decorators``
     174===========================
     175
     176.. module:: django.utils.decorators
     177    :synopsis: Functions that help with creating decorators for views.
     178
     179.. function:: method_decorator(decorator)
     180
     181    Converts a function decorator into a method decorator. See :ref:`decorating
     182    class based views<decorating-class-based-views>` for example usage.
     183
     184.. function:: decorator_from_middleware(middleware_class)
     185
     186    Given a middleware class, returns a view decorator. This lets you use
     187    middleware functionality on a per-view basis. The middleware is created
     188    with no params passed.
     189
     190.. function:: decorator_from_middleware_with_args(middleware_class)
     191
     192    Like ``decorator_from_middleware``, but returns a function
     193    that accepts the arguments to be passed to the middleware_class.
     194    For example, the :func:`~django.views.decorators.cache.cache_page`
     195    decorator is created from the
     196    :class:`~django.middleware.cache.CacheMiddleware` like this::
     197
     198         cache_page = decorator_from_middleware_with_args(CacheMiddleware)
     199
     200         @cache_page(3600)
     201         def my_view(request):
     202             pass
     203
    173204``django.utils.encoding``
    174205=========================
    175206
Back to Top