title: Django Rest Framework have a to_representation on a foreignKey with source
body: <p>I have a nested relation on a key that has a different name from the name that the key in the DB has.
  I am able to do both, just not if they are combined.</p>
  
  <p>I need the api name to be <code>countryOfOrigin</code> and the source is <code>country_of_origin</code>.</p>
  
  <p>However the only I get to work is either</p>
  
  <pre><code>[
    {
      "articleIdOwn": "1234abc",
      "articleNameOwn": "1234abc",
      "countryOfOrigin": "DE"
    }
  ]
  </code></pre>
  
  <p>where the serializer looks like this:</p>
  
  <pre class="lang-py prettyprint-override"><code>class ProductSerializer(serializers.ModelSerializer):
      articleIdOwn = serializers.CharField(source='article_id_own')
      articleNameOwn = serializers.CharField(source='article_name_own')
      countryOfOrigin = serializers.PrimaryKeyRelatedField(source='country_of_origin', read_only=True)
  
      class Meta:
          model = User_Product
          fields = ['articleIdOwn', 'articleNameOwn','countryOfOrigin']
  </code></pre>
  
  <p>Or this:</p>
  
  <pre><code>[
    {
      "articleIdOwn": "1234abc",
      "articleNameOwn": "1234abc",
      "country_of_origin": {
        "isoCode": "DE",
        "country": "Deutschland"
      }
    }
  ]
  </code></pre>
  
  <p>where the serializer looks like this:</p>
  
  <pre class="lang-py prettyprint-override"><code>class HS_CountriesSerializer(serializers.ModelSerializer):
      isoCode = serializers.CharField(source='iso_code', read_only=True)
      country = serializers.CharField(read_only=True)
  
      class Meta:
          model = HS_Countries
          fields = ['isoCode', 'country']
  
  class ProductSerializer(serializers.ModelSerializer):
      articleIdOwn = serializers.CharField(source='article_id_own')
      articleNameOwn = serializers.CharField(source='article_name_own')
  
      class Meta:
          model = User_Product
          fields = ['articleIdOwn', 'articleNameOwn', 'country_of_origin']
  
      def to_representation(self, instance):
          self.fields['country_of_origin'] = HS_CountriesSerializer(read_only=True)
          return super().to_representation(instance)
  </code></pre>
  
  <p><br><br>
  I however want it to look like this:</p>
  
  <pre><code>[
    {
      "articleIdOwn": "1234abc",
      "articleNameOwn": "1234abc",
      "countryOfOrigin": {
        "isoCode": "DE",
        "country": "Deutschland"
      }
    }
  ]
  </code></pre>
  
  <p>The the models of Product and Countries</p>
  
  <pre class="lang-py prettyprint-override"><code>class User_Product(models.Model):
      key = models.CharField(max_length=10)
      code = models.ForeignKey('HS_Code', on_delete=models.CASCADE, null=True)
      article_id_own = models.TextField()
      article_name_own = models.TextField()
      country_of_origin = models.ForeignKey(
          'HS_Countries', on_delete=models.CASCADE, null=False)
  
  class HS_Countries(models.Model):
      iso_code = models.CharField(primary_key=True, max_length=2)
      country = models.CharField(max_length=255)
  </code></pre>