code: def _redirect_url(request):
      
  
      next = request.GET.get(REDIRECT_FIELD_NAME)
  
      if not next:
          if settings.CAS_IGNORE_REFERER:
              next = settings.CAS_REDIRECT_URL
          else:
              next = request.META.get('HTTP_REFERER', settings.CAS_REDIRECT_URL)
  
          host = request.get_host()
          prefix = (('http://', 'https://')[request.is_secure()] + 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.
  
      :param: request RequestObj