from django.http import HttpResponseRedirect | |
from django.core.urlresolvers import reverse | |
class RequireSignIn(object): | |
def dispatch(self, request, *args, **kwargs): | |
if not request.user.is_authenticated(): | |
url = '{0}?next={1}'.format(reverse('signin'), request.path) | |
return HttpResponseRedirect(url) | |
return super(RequireSignIn, self).dispatch(request, *args, **kwargs) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment