def class_view_decorator(function_decorator):
def simple_decorator(View):<EOL><INDENT>View.dispatch = method_decorator(function_decorator)(View.dispatch)<EOL>return View<EOL><DEDENT>return simple_decorator<EOL>
Converts a function based decorator into a class based decorator usable
on class based Views.

Can't subclass the `View` as it breaks inheritance (super in particular),
so we monkey-patch instead.

From: http://stackoverflow.com/a/8429311/58107