(self)
| 45 | return self.redirect_field_name |
| 46 | |
| 47 | def handle_no_permission(self): |
| 48 | if self.raise_exception or self.request.user.is_authenticated: |
| 49 | raise PermissionDenied(self.get_permission_denied_message()) |
| 50 | |
| 51 | path = self.request.build_absolute_uri() |
| 52 | resolved_login_url = resolve_url(self.get_login_url()) |
| 53 | # If the login url is the same scheme and net location then use the |
| 54 | # path as the "next" url. |
| 55 | login_scheme, login_netloc = urlsplit(resolved_login_url)[:2] |
| 56 | current_scheme, current_netloc = urlsplit(path)[:2] |
| 57 | if (not login_scheme or login_scheme == current_scheme) and ( |
| 58 | not login_netloc or login_netloc == current_netloc |
| 59 | ): |
| 60 | path = self.request.get_full_path() |
| 61 | return redirect_to_login( |
| 62 | path, |
| 63 | resolved_login_url, |
| 64 | self.get_redirect_field_name(), |
| 65 | ) |
| 66 | |
| 67 | |
| 68 | class LoginRequiredMixin(AccessMixin): |
no test coverage detected