code: def get_history_user(self, instance):
          
          try:
              return instance._history_user
          except AttributeError:
              request = None
              try:
                  if self.thread.request.user.is_authenticated:
                      request = self.thread.request
              except AttributeError:
                  pass
  
          return self.get_user(instance=instance, request=request)
docs: Get the modifying user from instance or middleware.