Ejemplo n.º 1
0
 def inner(request, *args, **kwargs):
     if not self.has_permission(request):
         if request.path == reverse('admin:logout',
                                    current_app=self.name):
             index_path = reverse('admin:index', current_app=self.name)
             return HttpResponseRedirect(index_path)
         # Inner import to prevent myrobogals.admin (app) from
         # importing django.contrib.auth.models.User (unrelated model).
         from myrobogals.auth.views import redirect_to_login
         return redirect_to_login(
             request.get_full_path(),
             reverse('admin:login', current_app=self.name))
     return view(request, *args, **kwargs)
Ejemplo n.º 2
0
 def inner(request, *args, **kwargs):
     if not self.has_permission(request):
         if request.path == reverse('admin:logout', current_app=self.name):
             index_path = reverse('admin:index', current_app=self.name)
             return HttpResponseRedirect(index_path)
         # Inner import to prevent myrobogals.admin (app) from
         # importing django.contrib.auth.models.User (unrelated model).
         from myrobogals.auth.views import redirect_to_login
         return redirect_to_login(
             request.get_full_path(),
             reverse('admin:login', current_app=self.name)
         )
     return view(request, *args, **kwargs)
Ejemplo n.º 3
0
 def _wrapped_view(request, *args, **kwargs):
     if test_func(request.user):
         return view_func(request, *args, **kwargs)
     path = request.build_absolute_uri()
     resolved_login_url = resolve_url(login_url or settings.LOGIN_URL)
     # If the login url is the same scheme and net location then just
     # use the path as the "next" url.
     login_scheme, login_netloc = urlparse(resolved_login_url)[:2]
     current_scheme, current_netloc = urlparse(path)[:2]
     if ((not login_scheme or login_scheme == current_scheme) and
             (not login_netloc or login_netloc == current_netloc)):
         path = request.get_full_path()
     from myrobogals.auth.views import redirect_to_login
     return redirect_to_login(
         path, resolved_login_url, redirect_field_name)
Ejemplo n.º 4
0
 def _wrapped_view(request, *args, **kwargs):
     if test_func(request.user):
         return view_func(request, *args, **kwargs)
     path = request.build_absolute_uri()
     resolved_login_url = resolve_url(login_url or settings.LOGIN_URL)
     # If the login url is the same scheme and net location then just
     # use the path as the "next" url.
     login_scheme, login_netloc = urlparse(resolved_login_url)[:2]
     current_scheme, current_netloc = urlparse(path)[:2]
     if ((not login_scheme or login_scheme == current_scheme)
             and (not login_netloc or login_netloc == current_netloc)):
         path = request.get_full_path()
     from myrobogals.auth.views import redirect_to_login
     return redirect_to_login(path, resolved_login_url,
                              redirect_field_name)