code: def allow_ajax(request):
      
      if request.META.get('REMOTE_ADDR', None) not in settings.INTERNAL_IPS:
          return False
      if toolbar_version < LooseVersion('1.8') \
              and request.get_full_path().startswith(DEBUG_TOOLBAR_URL_PREFIX) \
              and request.GET.get('panel_id', None) != 'RequestHistoryPanel':
          return False
      return bool(settings.DEBUG)
docs: Default function to determine whether to show the toolbar on a given page.