title: Pass variable (non-model-field) to serializer in django rest framework
body: <p>I added a non model field to my serializer but after I hit api it returns the field as None value it doesn't store the value to use it in serializer function</p>
  
  <p>serializers.py</p>
  
  <pre><code>class LeaveTeamSerializer(serializers.ModelSerializer):
      user_id = serializers.SerializerMethodField()
  
      class Meta:
          model = Team
          fields = ['id', 'name', 'user_id', 'players']
  
      def get_user_id(self, *args, **kwargs):
          user_id = None  # kwargs['context']['request'].user_id
          return user_id # user_id it's not who did the request it is other user_id
  
      def update(self, instance, validated_data):
          user_id = validated_data.get('user_id')
          user = self.context['request'].user
  
          if user_id is None or user_id == '':
              instance.players.remove(user)
          else:
              instance.players.remove(user_id)
          instance.save()
          return instance
  </code></pre>
  
  <p>views.py</p>
  
  <pre><code>class LeaveTeamListAPIView(RetrieveUpdateAPIView):
      queryset = Team.objects.all()
      serializer_class = LeaveTeamSerializer
  
      def get_queryset(self):
          return Team.objects.filter(players=self.request.user) and Team.objects.filter(admin=self.request.user)
  </code></pre>
  
  <p>json put request</p>
  
  <pre><code>{
      "user_id":"22",
      "name":"a"
  }
  </code></pre>
  
  <p>what i need is retrieve user_id (not the user who did the request but it is other user_id) value from json request as above json code to serializer class to use it in if statement.</p>
  
  <p>please any one has the solution help me 
  I tried to over ride the context but it didnt work fine with me </p>
  
  <p>thanks </p>
  
  <p><strong>Edit</strong></p>
  
  <pre><code>`class LeaveTeamSerializer(serializers.ModelSerializer):
      user_id = serializers.CharField(write_only=True)
  
      class Meta:
          model = Team
          fields = ['id', 'name', 'user_id', 'players']
  
      def update(self, instance, validated_data):
          user_id = self.user_id
          print(user_id)        
          user = self.context['request'].user
  
          if user_id is None or user_id == '':
              instance.players.remove(user)
          else:
              instance.players.remove(user_id)
          instance.save()
          return instance
  </code></pre>
  
  <p>`</p>