title: django-rest-framework - What is the equivalent of "perform_create" in APIView
body: <p>Where can I set the associated model when I'm creating an object in <code>APIView</code>?</p>
  
  <pre><code>def perform_create(self, serializer): 
       serializer.save(owner=self.request.user)
  </code></pre>
  
  <p>The above works in <code>generics.ListAPIView</code> but what about <code>APIView</code>? I have two models <code>A</code> and <code>B</code>. <code>B</code> has a <code>ForeignKey</code> to <code>A</code>. When creating an instance of <code>B</code> how do I set the <code>ForeignKey</code> before saving? </p>
  
  <pre><code>a = A.objects.get(id=request.DATA['a_id'])
  serializer = BSerializer(data=request.DATA)
  
       if serializer.is_valid():
             b = serializer.save(a=a)
  </code></pre>
  
  <p>If I include the <code>a</code> field in <code>BSerializer</code>, this complains that <code>a This field is required</code>. If I exclude it, then it gives an <code>IntegrityError</code>. How is it supposed to be done?</p>