title: Django REST Framework Serialization POST is slow
body: <p>I am running on Django 2.1.1 and Python 3.6.5 and am performing a reasonably large POST operation (32,000 JSON objects). I have the following:</p>
  
  <p>Model:</p>
  
  <pre><code>class Data(models.Model):
      investigation = models.ForeignKey(Investigation)
      usage = models.FloatField()
      sector = models.CharField(max_length=100, blank=False, default='')
      cost = models.FloatField()
      demand = models.FloatField()
  </code></pre>
  
  <p>Serializer:</p>
  
  <pre><code>class DataSerializer(serializers.ModelSerializer):
      class Meta:
          model = Data
          fields = ('investigation', 'usage', 'sector', 'cost', 'demand')
  </code></pre>
  
  <p>View:</p>
  
  <pre><code>class DataView(generics.CreateAPIView):
      def create(self, request, pk, format=None):
          data_serializer = DataSerializer(data=request.data, many=True)
          if data_serializer.is_valid():
              data_serializer.save()
  </code></pre>
  
  <p>The problems come at both the is_valid() and save() steps which each fire off a separate query for each of the 32,000 objects.</p>
  
  <p>I've spent a long time looking into the issue and I'm guessing that the is_valid() step is slow because of the N+1 query problem since the foreign key is being looked up each time (although I could be wrong about this!) but I have no idea how to implement the prefetch_related method in this framework.</p>
  
  <p>The save() step (which is the slowest part) obviously needs to be done in one query (probably a bulk_create) but I can't find where to add the bulk_create step in. I've read <a href="https://stackoverflow.com/questions/33826742/how-can-i-bulk-create-in-django-rest-serializer">this question</a> but am still none the wiser from the answer. I tried to create a ListSerializer as the question suggests but the objects still seemed to be serialized one by one. </p>
  
  <p>Any pointers would be greatly appreciated.</p>