title: POST 400: Bad request - Using Django REST API and React
body: <p>I'm pretty new to web development so please forgive me in advance for my ignorance.</p>
  
  <p>I'm using React to try to post data to server endpoint managed by Django using this method:</p>
  
  <pre><code>sendData(data) {
    const url = "http://127.0.0.1:8080/api/filtros/1/";
    const requestOptions = {
      method: "POST",
      headers: {
        Accept: "application/json",
        "Content-Type": "application/json"
      },
      body: JSON.stringify(data)
    };
    fetch(url, requestOptions);
  }
  </code></pre>
  
  <p>On the onClick of a NavDropdown React component:</p>
  
  <pre><code>&lt;NavDropdown.Item
    key={item.id}
    onClick={() =&gt;
      this.sendData({
        id: 0,
        dimension_id: dimension.id,
        item_id: item.id,
        usuario_id: 1
      })
    }
  &gt;
    {item.descripcion}
  &lt;/NavDropdown.Item&gt;
  </code></pre>
  
  <p>This is how I register the url on the router using Django:</p>
  
  <pre><code>router.register('api/filtros/1', FiltroUsuariosViewSet, 'filtro')
  </code></pre>
  
  <p>My Django ModelViewSet looks like this:</p>
  
  <pre><code>class FiltroUsuariosViewSet(viewsets.ModelViewSet):
  
      queryset = FiltroUsuarios.objects.all()
      permission_classes = [
          permissions.AllowAny
      ]
      serializer_class = FiltroUsuariosSerializers
  </code></pre>
  
  <p>And my Django Serializer looks like this:</p>
  
  <pre><code>class FiltroUsuariosSerializers (serializers.ModelSerializer):
      class Meta:
          model = FiltroUsuarios
          fields = ('id', 'dimension_id', 'item_id', 'usuario_id')
  
      def create(self, validated_data):
          post = FiltroUsuarios.objects.create(**validated_data)
  </code></pre>
  
  <p>When I click on the Component I get this: 
  <code>POST http://127.0.0.1:8080/api/filtros/1/ 400 (Bad Request)</code>
  and apparently the error is on the fetch request.</p>
  
  <p>Do you guys have any idea on whats the problem?</p>
  
  <p>Thanks a lot in advance!</p>