title: Django Rest Framework many related field - Javascript ajax - corret format for list of ints
body: <p>I have a serializer class using DRF:</p>
  
  <pre><code>class ItemSerializer(serializers.ModelSerializer):
      categories = serializers.PrimaryKeyRelatedField(many=True)
  </code></pre>
  
  <p>and I want to update the <code>categories</code> of an instance of the model via a <code>RetrieveUpdateDestroyAPIView</code> using this serializer via an ajax request.</p>
  
  <pre><code>var categories = [1,2,3];
  $.ajax({
      url : "/api/items/id",
      type: 'POST',
      headers: {
          'X-HTTP-Method-Override': 'PUT'
      },      
      // Form data
      data : {
        'categories':categories
      }
  });
  </code></pre>
  
  <p>Unfortuntely I cannot understand how to format the <code>categories</code> parameter.
  I tried as shown in the code above and the parameters are not passed to the serializer, the field <code>categories</code> in the serializer attributes is empty.
  In this case, the request parameter is a list but the name is <code>categories[]</code> and not <code>categories</code></p>
  
  <p>I also tried <code>JSON.stringify(categories)</code> but in this case the serializer do not validate with error: <code>{"categories": ["Incorrect type.  Expected pk value, received unicode."]}</code>
  I figured out that in this case, the request parameter value is a string and not a list.</p>
  
  <p>On the other hand, I am able to do the PUT request via the DRF browsable api and in this case the parameter is named <code>categories</code> and it's value is a list.</p>
  
  <p>Do you know how should I send the parameter with ajax, i.e. send the param so that is is present in the request parameter as a list an with name <code>categories</code>?</p>
  
  <p>Thank you very much!</p>