You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

17 regels
521 B

  1. from django.conf import settings
  2. from django.http import HttpResponseRedirect
  3. from django.core.urlresolvers import reverse
  4. class Public(object):
  5. def process_request(self, request):
  6. if settings.PUBLIC is False and not request.user.is_authenticated():
  7. acceptable_paths = [
  8. '/login/',
  9. '/private/',
  10. '/register/',
  11. ]
  12. if request.path not in acceptable_paths:
  13. return HttpResponseRedirect(reverse('users:private'))