title: Serializing foreign key in Django rest framework (A->B->C)
body: <p>How do i serialize foreign key that already refers to a foreign key of another table. Currently I am having three tables A,B and C (A->B->C). A refers to B and B refers to C. I need to get JSON as shown below</p>
  
  <pre><code>A:
  {
   A_id:1,
   A_name:'aaa',
   B:
   {
     B_id:1,
     B_name:'bbb'
     C:
     {
       C_id:1,
       C_name:'ccc'
      }
    }
   }
  </code></pre>
  
  <p>I am able to get the JSON for one reference. i.e; A->B
  i used <code>RelatedField</code> and overrided <code>to_representation</code> function to achieve this. This is the code i used</p>
  
  <pre><code>class B_foreign(serializers.RelatedField):
      def to_representation(self, value):
          return value
  
  
  class ASerializer(serializers.ModelSerializer):
      B = B_foreign(source='B_id', read_only=True)
      class Meta:
          model = A
          fields = '__all__'
  </code></pre>
  
  <p>Now what will i do to refer 'C' from B ? Do another RelatedField class and override to_representation() function?
  I tried that too. It didn't work. Can someone help me with solution?</p>