Created
July 11, 2011 00:12
-
-
Save issackelly/1075119 to your computer and use it in GitHub Desktop.
Show method_decorator on a Class Based View
This file contains hidden or 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 | |
from django.views.generic.base import TemplateView | |
from django.contrib.auth.decorators import login_required | |
class MaiView(TemplateView): | |
template_name = "mai/view.html" | |
@method_decorator(login_required) | |
def dispatch(self, request, *args, **kwargs): | |
return super(MaiView, self).dispatch(request, *args, **kwargs) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment