2012-09-13 05:31:32 +00:00
|
|
|
from django.utils.decorators import method_decorator
|
|
|
|
from auth.decorators import login_required
|
|
|
|
|
2013-04-02 11:56:44 +00:00
|
|
|
# from base.decorators import ctx_switch_required
|
2012-09-13 05:31:32 +00:00
|
|
|
|
|
|
|
class LoginRequiredMixin(object):
|
|
|
|
"""
|
|
|
|
View mixin which verifies that the user has authenticated.
|
|
|
|
|
|
|
|
NOTE:
|
|
|
|
This should be the left-most mixin of a view.
|
|
|
|
"""
|
|
|
|
|
|
|
|
@method_decorator(login_required)
|
|
|
|
def dispatch(self, *args, **kwargs):
|
|
|
|
return super(LoginRequiredMixin, self).dispatch(*args, **kwargs)
|
|
|
|
|
2013-04-02 11:56:44 +00:00
|
|
|
# class CtxSwitchRequiredMixin(object):
|
|
|
|
# @method_decorator(ctx_switch_required)
|
|
|
|
# def dispatch(self, *args, **kwargs):
|
|
|
|
# return super(CtxSwitchRequiredMixin, self).dispatch(*args, **kwargs)
|
2012-09-13 05:31:32 +00:00
|
|
|
|