code: def login_required_with_ajax(function=None, redirect_field_name=REDIRECT_FIELD_NAME):
      
      # NOTE: currently only this format works: @login_required_with_ajax()
      # But this format errors: @login_required_with_ajax
      if function is None:
          function = lambda u: u.is_authenticated()
      return user_passes_test_with_ajax(function, redirect_field_name=redirect_field_name)
docs: Decorator for views that checks that the user is logged in,
      redirecting to the log-in page if necessary, but returns a special
      response for ajax requests.  See
      :meth:`eulcommon.djangoextras.auth.decorators.user_passes_test_with_ajax`.
  
      Example usage::
  
          @login_required_with_ajax()
          def my_view(request):
              ...