docs: def ajax_login_required(view_func):
      """Handle non-authenticated users differently if it is an AJAX request."""
  
      @wraps(view_func, assigned=available_attrs(view_func))
      def _wrapped_view(request, *args, **kwargs):
          if request.is_ajax():
              if request.user.is_authenticated():
                  return view_func(request, *args, **kwargs)
              else:
                  response = http.HttpResponse()
                  response['X-Django-Requires-Auth'] = True
                  response['X-Django-Login-Url'] = settings.LOGIN_URL
                  return response
          else:
              return login_required(view_func)(request, *args, **kwargs)
      return _wrapped_view