title: Django DRF: POST to CreateAPIView with list of PrimaryKeyRelatedFields
body: <p>I have a many-to-one relationship between the following models</p>
  
  <pre><code>class Story(models.Model):
  
      id = models.CharField(max_length=12, primary_key=True)
  
  
  class Article(models.Model):
  
      id = models.CharField(max_length=16, primary_key=True)
      title = models.CharField(max_length=500)
      address = models.URLField()
  
      story = models.ForeignKey(to=Story, blank=True, null=True, on_delete=models.CASCADE)
  </code></pre>
  
  <p>Suppose I post several article objects to the database successfully.
  I identify that the articles with the ids</p>
  
  <pre><code>['1', '2', '3'] 
  </code></pre>
  
  <p>are all reporting on a particular Story.</p>
  
  <p>I want create a Story via a POST method to a CreateAPIView view like this</p>
  
  <pre><code>POST http://127.0.0.1/news/story {articles': ['1', '2', '3']}
  </code></pre>
  
  <p>Here is my serializer</p>
  
  <pre><code>class StorySerializer(serializers.ModelSerializer):
  
       id = serializers.ReadOnlyField()
       articles = serializers.PrimaryKeyRelatedField(many=True, allow_empty=False, queryset=Article.objects.all())
  
       class Meta:
           model = Story
           fields = ('id', 'articles')
  </code></pre>
  
  <p>Here is my view</p>
  
  <pre><code>class StoryList(generics.ListCreateAPIView):
  
      serializer_class = StorySerializer
      queryset = Story.objects.all()
  </code></pre>
  
  <p>I want to ensure that 1) the articles exist. 2) the article story is updated before the Story object is created.</p>
  
  <p>Suppose I run this as it is, I will get the following error:</p>
  
  <blockquote>
    <p>Got a <code>TypeError</code> when calling <code>Story.objects.create()</code>. This may be
    because you have a writable field on the serializer class that is not
    a valid argument to <code>Story.objects.create()</code>. You may need to make the
    field read-only, or override the StorySerializer.create() method to
    handle this correctly.</p>
  </blockquote>
  
  <p>So here is an attempt to override the create() method:</p>
  
  <pre><code>    def create(self, validated_data):
  
          story_id = None
  
          for article_id in validated_data['articles']:
              article = Article.objects.get(id=article_id)
              story_id = article.story_id
              if story_id:
                  break
  
          story = Story.objects.get(id=story_id) if story_id else Story.objects.create()
  
          for article_id in validated_data['articles']:
              article = Article.objects.get(id=article_id)
              article.story_id = story.id
              article.save()
  
          story.save()
          return story
  
      def update(self, instance, validated_data):
          return self.create(validated_data)
  </code></pre>
  
  <p>The idea here is make sure there are no overlapping stories by merging them.</p>
  
  <p>When I try POST to this view, I encounter a <code>DoesNotExist</code> thrown by the line <code>Article.objects.get(id=article_id)</code></p>
  
  <p>My questions are </p>
  
  <p>1) <em>Minor</em> : Why am I getting this error</p>
  
  <p>2) <em>Major</em> : Is there a cleaner / correct way of addressing such a use case in django?</p>
  
  <p>Thank you</p>