code: def login(self, request, extra_context=None):
          
          redirect_to = request.POST.get(REDIRECT_FIELD_NAME, request.GET.get(REDIRECT_FIELD_NAME))
  
          if not redirect_to or not is_safe_url(url=redirect_to, allowed_hosts=[request.get_host()]):
              redirect_to = resolve_url(settings.LOGIN_REDIRECT_URL)
  
          return redirect_to_login(redirect_to)
docs: Redirects to the site login page for the given HttpRequest.