title: django rest framework lookup_field through OneToOneField
body: <p><a href="https://gist.github.com/ranman/3d97ea9054c984bca75e" rel="nofollow noreferrer">https://gist.github.com/ranman/3d97ea9054c984bca75e</a></p>
  <p><strong>Desired Behavior</strong><br />
  User lookup happens by the username: <code>/api/users/randall</code><br />
  Speaker lookup happens by the username as well: <code>/api/speakers/randall</code></p>
  <p><strong>Constraints</strong><br />
  Not all users are speakers. All speakers are users.</p>
  <p><strong>models.py</strong></p>
  <pre><code>from django.contrib.auth.models import User
  
  class Speaker(models.Model):
      user = models.OneToOneField(User)
  </code></pre>
  <p><strong>serializers.py</strong></p>
  <pre><code>class UserSerializer(serializers.HyperlinkedModelSerializer):
      class Meta:
          model = User
          fields = ('url', 'username', 'email', 'groups')
          lookup_field = 'username'
   
  class SpeakerSerializer(serializers.HyperlinkedModelSerializer):
      user = serializers.HyperlinkedRelatedField(
          view_name='user-detail',
          read_only=True,
          lookup_field='username'
      )
      class Meta:
          model = Speaker
          lookup_field = 'user'
  </code></pre>
  <p><strong>views.py</strong></p>
  <pre><code>class UserViewSet(viewsets.ModelViewSet):
      queryset = User.objects.all()
      serializer_class = UserSerializer
      lookup_field = 'username'
      
  class SpeakerViewSet(viewsets.ModelViewSet):
      queryset = Speaker.objects.all().select_related('user')
      serializer_class = SpeakerSerializer
      lookup_field = &quot;user&quot;
  </code></pre>
  <p>I've tried various different invocations of lookup_field and serializer types to get this working to no avail. It may not be possible without a lot more code. I'm just wondering what direction I can take.</p>