code: def get_redirect_url(request):
      
  
      next_ = request.GET.get(REDIRECT_FIELD_NAME)
      if not next_:
          redirect_url = resolve_url(django_settings.CAS_REDIRECT_URL)
          if django_settings.CAS_IGNORE_REFERER:
              next_ = redirect_url
          else:
              next_ = request.META.get('HTTP_REFERER', redirect_url)
          prefix = urllib_parse.urlunparse(
              (get_protocol(request), request.get_host(), '', '', '', ''),
          )
          if next_.startswith(prefix):
              next_ = next_[len(prefix):]
      return next_
docs: Redirects to referring page, or CAS_REDIRECT_URL if no referrer is
      set.