Created
October 24, 2013 02:23
-
-
Save chriskief/7130250 to your computer and use it in GitHub Desktop.
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.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