title: Django create() argument after ** must be a mapping, not list
body: <p>I'm creating a writable nested serializer using DRF, I've been following the official documentation (<a href="https://www.django-rest-framework.org/api-guide/relations/#writable-nested-serializers" rel="nofollow noreferrer">https://www.django-rest-framework.org/api-guide/relations/#writable-nested-serializers</a>).</p>
  <p>My use case is very similar to the one given in the documentation.</p>
  <p><strong>models.py</strong></p>
  <pre><code>class Album(models.Model):
      album_name = models.CharField(max_length=100)
      artist = models.CharField(max_length=100)
  
  class Track(models.Model):
      album = models.ForeignKey(Album, related_name='tracks', on_delete=models.CASCADE)
      order = models.IntegerField()
      title = models.CharField(max_length=100)
      duration = models.IntegerField()
  
      class Meta:
          unique_together = ['album', 'order']
          ordering = ['order']
  
      def __str__(self):
          return '%d: %s' % (self.order, self.title)
  
  
  </code></pre>
  <p><strong>serializer.py</strong></p>
  <pre><code>class TrackSerializer(serializers.ModelSerializer):
      class Meta:
          model = Track
          fields = ['order', 'title', 'duration']
  
  class AlbumSerializer(serializers.ModelSerializer):
      tracks = TrackSerializer(many=True)
  
      class Meta:
          model = Album
          fields = ['album_name', 'artist', 'tracks']
  
      def create(self, validated_data):
          tracks_data = validated_data.pop('tracks')
          album = Album.objects.create(**validated_data)
          for track_data in tracks_data:
              Track.objects.create(album=album, **track_data)
          return album
  </code></pre>
  <p>My view in which I'm passing my data(I'm doing some post processing and creating this data) to the serializer looks like below</p>
  <p>NOTE: I'm creating this data in my view. <em>data</em> as per my understanding is a dictionary and 'tracks' has a list of dictionaries</p>
  <p><strong>views.py</strong></p>
  <pre><code>@api_view(['POST'])
  def my_view():
      ....
      my_data = 
      {
          'album_name': 'The Grey Album',
          'artist': 'Danger Mouse',
          'tracks': [
              {'order': 1, 'title': 'Public Service Announcement', 'duration': 245},
              {'order': 2, 'title': 'What More Can I Say', 'duration': 264},
              {'order': 3, 'title': 'Encore', 'duration': 159},
          ]
      }
      serializer = AlbumSerializer(data= my_data)
      serializer.is_valid()
      ....
  
  </code></pre>
  <p>Now every time I call <strong>my_view</strong> POST API, I get the following error</p>
  <blockquote>
  <p><strong>create() argument after ** must be a mapping, not list</strong></p>
  </blockquote>
  <p>My primary suspect is the format of <em>my_data</em> I believe, based on the error inside my_data, the 'tracks' should have a list of values as a map object maybe?</p>
  <p>I've tried to follow some of the answers suggested in the stack overflow community</p>
  <ol>
  <li><a href="https://stackoverflow.com/questions/44978045/serialize-multiple-models-and-send-all-in-one-json-response-django-rest-framewor">Serialize multiple models and send all in one json response django rest framework</a></li>
  <li><a href="https://stackoverflow.com/questions/53418075/create-argument-after-must-be-a-mapping-not-list-django-rest-framework-i">create() argument after ** must be a mapping, not list, Django REST Framework (implementing my own create method error)</a></li>
  </ol>
  <p>I've searched everywhere to understand what is going on but I couldn't, any leads on this would be very helpful, Thanks in advance!</p>
  <p><strong>Update</strong></p>
  <p>So I tried to verify if the data is valid by using</p>
  <blockquote>
  <p>python manager shell</p>
  </blockquote>
  <p>The serializer.is_valid() is returning True, but I'm getting an error while saving the searializer</p>
  <blockquote>
  <p>TypeError: create() argument after ** must be a mapping, not list</p>
  </blockquote>