This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.utils.decorators import method_decorator | |
def class_decorator(decorator): | |
def inner(cls): | |
orig_dispatch = cls.dispatch | |
@method_decorator(decorator) | |
def new_dispatch(self, request, *args, **kwargs): | |
return orig_dispatch(self, request, *args, **kwargs) | |
cls.dispatch = new_dispatch | |
return cls |