title: django-rest-framework custom viewset retrive with multiple lookup args
body: <p>I have two models say A and B.</p>
  
  <p><strong>models look like</strong></p>
  
  <pre><code>class A(models.Model):
      name = models.CharField(max_length=100)
      description = models.CharField(max_length=1000)
      slug = models.CharField(max_length=100)
  
  class B(models.Model):
      name = models.CharField(max_length=100)
      description = models.CharField(max_length=1000)
      slug = models.CharField(max_length=100)
      A = models.foreignkey(A, models.SET_NULL, blank=true)
  </code></pre>
  
  <p><strong>serializers</strong></p>
  
  <pre><code>Class ASerializer(serializers.HyperlinkedModelSerializer):
      class Meta:
           model = A
           fields = '__all__'
           lookup_field = 'slug'
           extra_kwargs = {'url': {'lookup_field': 'slug'}}
  
  
  Class BSerializer(serializers.ModelSerializer):
      class Meta:
           model = B
           fields = '__all__'
  </code></pre>
  
  <p><strong>model viewset</strong></p>
  
  <pre><code>from rest_framework import viewsets, permissions
  from rest_framework.response import Response
  from rest_framework.decorators import action
  from .models import (A, B)
  from .serializers import (ASerializer, BSerializer)
  
  
  Class AViewSet(viewsets.ModelViewSet):
       queryset = A.objects.all()
       serializer_class = ASerializer
       permission_classes =                           (permissions.DjangoModelPermissionsOrAnonReadOnly, )
       lookup_field = 'slug'
  
       def retrieve(self, request, *args, **kwargs):
            instance = self.get_object()
            bs = B.objects.filter(A=instance.id)
            serializer = BSerializer(bs, many=True)
  
            return Response(serializer.data)
  </code></pre>
  
  <p>I want to access a url something like </p>
  
  <p><code>Url: ^A/&lt;slug&gt;/B/slug&gt;/$</code></p>
  
  <p>I go through Django Restframework documention and found that we can add custom url like ( <a href="http://www.django-rest-framework.org/api-guide/routers/#routing-for-extra-actions" rel="nofollow noreferrer">drf-custom-rounting</a>. I don't get how to make access url pattern above. </p>
  
  <p>How to customize like that? </p>
  
  <p><strong>EDIT:</strong> 
  I have solved my problem. I found a similar type of problem solution <a href="https://stackoverflow.com/questions/27463055/django-rest-framework-add-a-viewset-as-detail-on-another-viewset">here</a>. Thank you for all your response. </p>