title: Django Rest framework cant join tables
body: <p>I am trying to fetch related data from a parent table using an API. I am trying to get the details from the operator table which has a one-to-one field with the user table.
  After going through various answers I understood how to join tables but due to some reason I am unable to fetch the user data</p>
  <h3>serializer.py</h3>
  <pre class="lang-py prettyprint-override"><code>class OpDetailsSerializer(DynamicFieldsModelSerializer):
      user = UserSerializer(source=&quot;operator_details&quot;,many=False, read_only=True)
      print(user.data)
      class Meta:
          model = OperatorDetails
          fields = ('gst_no','pan','user')
  </code></pre>
  <h3>models.py</h3>
  <pre class="lang-py prettyprint-override"><code>class OperatorDetails(models.Model):
      operator=models.OneToOneField(settings.AUTH_USER_MODEL,related_name=&quot;operator_details&quot;,on_delete=models.CASCADE,primary_key=True)
      pan = models.CharField(max_length=10, unique=True, null=True,blank=True)
      gst_no = models.CharField(max_length=15, unique=True,null=True,blank=True)
  
      def __str__(self):
          return str(self.operator)
  </code></pre>
  <h3>views.py</h3>
  <pre><code>def view_operator_info(request):
      fields = ('operator','pan','gst_no','user')
  
      operator = OperatorDetails.objects.get(operator__id=request.user.id)
      serializer = OpDetailsSerializer(operator,fields=fields)
      content = {
              &quot;status&quot;: True,
              &quot;response&quot;: status.HTTP_200_OK,
              &quot;message&quot;: &quot;Operator details&quot;,
              &quot;data&quot;:serializer.data
          }
  
      return Response(content)
  </code></pre>
  <p>Actual Output</p>
  <pre class="lang-json prettyprint-override"><code>{
      &quot;status&quot;: true,
      &quot;response&quot;: 200,
      &quot;message&quot;: &quot;Operator details&quot;,
      &quot;data&quot;: {
          &quot;gst_no&quot;: &quot;test&quot;,
          &quot;pan&quot;: &quot;test&quot;
      }
  }
  </code></pre>
  <p>expected Output</p>
  <pre><code>{
      &quot;status&quot;: true,
      &quot;response&quot;: 200,
      &quot;message&quot;: &quot;Operator details&quot;,
      &quot;data&quot;: {
          &quot;gst_no&quot;: &quot;test&quot;,
          &quot;pan&quot;: &quot;test&quot;,
          &quot;user&quot;:{
               &quot;email&quot;:.....
                //data from user table
            }
      }
  }
  </code></pre>
  <p>can anyone help. Thanks in advance</p>