utils.decorators.method_decorator()

method_decorator(decorator, name='') [source]

Converts a function decorator into a method decorator. It can be used to decorate methods or classes; in the latter case, name is the name of the method to be decorated and is required.

decorator may also be a list or tuple of functions. They are wrapped in reverse order so that the call order is the order in which the functions appear in the list/tuple.

See decorating class based views for example usage.

Changed in Django 1.9:

The ability to decorate classes, the name parameter, and the ability for decorator to accept a list/tuple of decorator functions were added.

doc_Django
2016-10-09 18:40:22
Comments
Leave a Comment

Please login to continue.