title: Django REST bulk post / post array of JSON objects
body: <p>I have started to play around with the Django REST framework. So far I succeeded in creating a serializer for my object, creating the post view, post objects and return objects via Javascript's $.post(). So right now I have a proper conversion between my JSONs and Django model objects.</p>
  
  <p>The problem is that I have an array of objects [A1, A2, ..., An]. Right now when I need to post such an array I do it object by object. Is there any possibility to post the whole array at once, and recover an array of objects inside my Django View? If so, what is the pattern to follow here? I guess I could define a new model which is an array of my current model, create a serializer for it, etc., but this does not seem too elegant.</p>
  
  <p>Below are my view and serializer:</p>
  
  <pre><code>#serializers.py
  class SearchRequestSerializer(serializers.ModelSerializer):
  
      def create(self):
          return SearchRequest(**self.validated_data)
  
      class Meta:
          model = SearchRequest
  
  
  
  #views.py
  @api_view(['POST'])
  def post_calculation(request):
      if request.method == 'POST':
  
          #JSON to serializer object
          serializer = SearchRequestSerializer(data=request.data, many=False)
          if (serializer.is_valid() == False):
              return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST)
  
          #create the Python object   
          search_request = serializer.create()
  
          #-- I do some processing stuff with the search_request object here ---
  
          #object back to JSON
          serializer3 = SearchRequestSerializer(search_request, many=False)
          return Response(serializer3.data) 
  </code></pre>