title: Django rest framework listfield valid integer is required formdata
body: <p>I am trying to make a post request on model with many to many field</p>
  
  <pre><code>class Product(models.Model):
      name = models.CharField(max_length=100)
      description = models.TextField()
      categories = models.ManyToManyField(Category)
      quantity = models.IntegerField()
      price = models.FloatField()
      attribute_values = models.ManyToManyField(Value)
      image = models.ImageField(blank=True)
  </code></pre>
  
  <p>My serializer class:</p>
  
  <pre><code>class ProductSerializer(serializers.ModelSerializer):
      categories = serializers.ListField(child=serializers.IntegerField())
      attribute_values = serializers.ListField(child=serializers.IntegerField())
  
      def create(self, validated_data):
          categories = validated_data.pop('categories')
          attribute_values = validated_data.pop('attribute_values')
          product = Product.objects.create(**validated_data)
  
          for cat_id in categories:
              category = Category.objects.get(pk=cat_id)
              product.categories.add(category)
  
          for value_id in attribute_values:
             value = Value.objects.get(pk=value_id)
             product.attribute_values.add(value)
  
         product.save()
         return product
  
      class Meta:
          model = Product
          fields = ('id', 'name', 'description', 'price', 'quantity', 'categories', 'image', 'attribute_values')
  </code></pre>
  
  <p>I am making post request with form data, as it contains image:</p>
  
  <pre><code>var formData = new FormData()
  let cats = Object.keys(selectedCategories).map(id =&gt; Number(id))
  
  formData.append('image', blob)
  formData.append('categories', cats)
  formData.append('attribute_values', attributes)
  formData.append('name', name)
  formData.append('description', description)
  formData.append('quantity', quantity)
  formData.append('price', 100)
  </code></pre>
  
  <p>However, the server responds with this error:</p>
  
  <pre><code> {"categories":{"0":["A valid integer is required."]},"attribute_values":{"0":["A valid integer is required."]}}
  </code></pre>
  
  <p>How do i make the server accept the array of integers with the form data, as it seems for me that on the client side everything is correct. Thanks in advance.</p>