【发布时间】:2015-07-28 21:09:27
【问题描述】:
我遵循本教程http://www.effectivedjango.com/tutorial/authzn.html。在那里我们创建了类,我们应该使用基于类的视图来扩展它。那么如果我有方法定义的视图呢?我该怎么办?
def some_private_view(request):
...
class LoggedInMixin(object):
@method_decorator(login_required)
def dispatch(self, *args, **kwargs):
return super(LoggedInMixin, self).dispatch(*args, **kwargs)
【问题讨论】:
标签: python django authentication django-views authorization