title: How to manually populate a relational model in Django REST
body: <p>I'm still new to Django and DRF. I have 2 models (Policy and Rescue) and Rescue is related to Policy by the Foreign Key policy_id. I have no issue to POST a JSON message and get Policy populated with the request data by CreateView. However, the 2nd model Rescue needs be populated based on some calculations from the JSON data POSTed to the Policy. Rescue cannot be POSTed beforehand. I tried hard but had no clue to do so. </p>
  
  <p>Is this something to do with nested serializer or something else? </p>
  
  <p>I've tried to </p>
  
  <p>Can I try this way: inside the class CreateView:</p>
  
  <pre><code>class CreateView(generics.CreateAPIView):
  
      def create(self, request, *args, **kwargs):
          my_serializer = self.get_serializer(data=request.data)
          ...
          # get a policy object based on 'policy_id' against serializer
          my_policy = Policy.objects.get(policy_id=my_serializer.data['policy_id'])
          ...
          ... # some calculations to work out a rescue id, and will be returned and saved.
          Rescue.objects.create(rescue_id='QD1234', policy=my_policy)
  </code></pre>