title: How can I display the values of a ManyToMany Field in Django Rest Framework instead of their Ids?
body: <p><strong>Model:</strong></p>
  <pre><code>class Genre(models.Model):
      name = models.CharField(max_length=100)
  
      def __str__(self):
          return self.name
  
  
  class Song(models.Model):
      name = models.CharField(max_length=200)
      genre = models.ManyToManyField(Genre)
  </code></pre>
  <p><strong>Serializers:</strong></p>
  <pre><code>class GenreSerializer(serializers.ModelSerializer):
  
      class Meta:
          model = Genre
          fields = '__all__'
  
  
  class SongSerializer(serializers.ModelSerializer):
  
      class Meta:
          model = Song
          fields = '__all__'
  
      def to_representation(self, instance):
          rep = super().to_representation(instance)
          print(GenreSerializer(instance.name).data)
          return rep
  </code></pre>
  <p>The above print in serializer gives: {'name': None}
  and the response is with the Genre ids instead of values:</p>
  <pre><code>[
      {
          &quot;id&quot;: 1,
          &quot;name&quot;: &quot;Abcd&quot;,
          &quot;genre&quot;: [
              1,
              3
          ]
      }
  ]
  </code></pre>
  <p>where genre <strong>1. Pop</strong> and <strong>3. Rock</strong></p>
  <p>What changes can I make to to_representation to print the values instead of the ids of Genre which is a ManyToManyField with Song Model.</p>