code: def set_user(user, sender, instance, **kwargs):
          
          try:
              app_label, model_name = settings.AUTH_USER_MODEL.split('.')
              auth_user_model = apps.get_model(app_label, model_name)
          except ValueError:
              auth_user_model = apps.get_model('auth', 'user')
          if sender == LogAction and isinstance(user, auth_user_model) and instance.user is None:
              instance.user = user
          if hasattr(threadlocal, 'actionslog'):
              instance.remote_ip = threadlocal.actionslog['remote_ip']
docs: Signal receiver with an extra, required 'user' kwarg. This method becomes a real (valid) signal receiver when
          it is curried with the user.