title: How to add an attribute to Django request object
body: <p>I try to add the <code>business</code> attribute to the request object by using my own middleware, it nicely works with <code>rest_framework.authentication.SessionAuthentication</code> and I can use <code>request.business</code> in my views. But when I try to authenticate with JWT method (<code>rest_framework_simplejwt.authentication.JWTAuthentication</code>) when my middleware code is run <code>request.user</code> is set to <code>AnonymouseUser</code> so can't fetch business associated with <code>user</code>? Why did this happen?</p>
  <pre><code># middleware.py
  
  class MyMiddleware:
      def __init__(self, get_response):
          self.get_response = get_response
  
      def __call__(self, request):
          request.business = None
  
          if request.user.is_authenticated and hasattr(request.user, 'business'):
              request.business = request.user.business
  
          response = self.get_response(request)
  
          return response
  </code></pre>
  <p>Middlewares:</p>
  <pre><code>MIDDLEWARE = [
      'corsheaders.middleware.CorsMiddleware',
      'django.middleware.security.SecurityMiddleware',
      'django.contrib.sessions.middleware.SessionMiddleware',
      'django.middleware.common.CommonMiddleware',
      'django.middleware.csrf.CsrfViewMiddleware',
      'django.contrib.auth.middleware.AuthenticationMiddleware',
      'django.contrib.messages.middleware.MessageMiddleware',
      'django.middleware.clickjacking.XFrameOptionsMiddleware',
      'my_app.middleware.MyMiddleware',
  ]
  </code></pre>
  <p>rest_framework settings:</p>
  <pre><code>REST_FRAMEWORK = {
      ...
      'DEFAULT_AUTHENTICATION_CLASSES': [
          'rest_framework_simplejwt.authentication.JWTAuthentication',
          'rest_framework.authentication.SessionAuthentication',
      ],
  }
  </code></pre>