title: Django REST-framework: Using serializer for simple ForeignKey-relationship
body: <p>I'm using the django REST-framework and try to map a simple foreign-key relationship to provide related data for further use, similar to the following request: </p>
  
  <p><a href="https://stackoverflow.com/questions/38139378/using-reverse-relationships-with-django-rest-frameworks-serializer?rq=1][1]">Using reverse relationships with django-rest-framework&#39;s serializer</a></p>
  
  <p>Instead of a result, I receive the following exception:</p>
  
  <p><em>Got AttributeError when attempting to get a value for field <code>album_name</code> on serializer <code>AlbumSerializer</code>.
  The serializer field might be named incorrectly and not match any attribute or key on the <code>int</code> instance.
  Original exception text was: 'int' object has no attribute 'album_name'.</em></p>
  
  <p><strong>Models:</strong></p>
  
  <pre><code>    class Album(models.Model):
          album_name = models.CharField(max_length=100)
          artist = models.CharField(max_length=100)
  
      class Track(models.Model):
          # album = models.ForeignKey(Album, related_name='tracks', on_delete=models.CASCADE)
          album = models.ForeignKey(Album, related_name='tracks', on_delete=models.CASCADE)
          order = models.IntegerField()
          title = models.CharField(max_length=100)
          duration = models.IntegerField()
  
          class Meta:
              unique_together = ('album', 'order')
              ordering = ['order']
  
          def __unicode__(self):
              return '%d: %s' % (self.order, self.title)
  </code></pre>
  
  <p><strong>Serializers:</strong></p>
  
  <pre><code>class AlbumSerializer(serializers.ModelSerializer):
      class Meta:
          model = Album
          fields = ('id', 'album_name', 'artist' )
  class TrackSerializer(serializers.ModelSerializer):
      album_id = AlbumSerializer(many=False, read_only=True)
      class Meta:
          model = Track
          fields = ('order', 'title', 'duration', 'album_id')
  </code></pre>
  
  <p><strong>View:</strong></p>
  
  <pre><code>class TrackView(viewsets.ModelViewSet):
      queryset = Track.objects.all().select_related('album')
      serializer_class = serializers.TrackSerializer
  </code></pre>
  
  <p><strong>What I have tried so far:</strong> </p>
  
  <ol>
  <li>Serializing Albums with related tracks as nested serializers, using a reverse relationship => <strong>works</strong></li>
  <li>Doing the work just for the TrackSerializer without nested Album => <strong>works</strong></li>
  <li>Doing the work just for the AlbumSerializer => <strong>works</strong></li>
  <li>Using the TrackSerializer as shown in the code-section but reducing the AlbumSerializer by every
  field except for the primary key 'id' => <strong>works</strong> (but I would need the
  whole data set of album)</li>
  <li>Changed the nested Serializer to a many-relationship by setting <em>many=True</em>. => dumps, since the framework tries to iterate on all fields of AlbumSerializer. </li>
  </ol>
  
  <p>Since I'm running out of ideas and material to browse for I'm asking the question:
  How to list all or single attributes (!= PrimaryKey) of Album for each Track in regards to my example.</p>