title: Django-rest-framework nested urls with drf-nested-routers
body: <p>I am building nested API with <a href="https://github.com/alanjds/drf-nested-routers" rel="nofollow noreferrer">drf-nested-routers</a> package.</p>
  <p>However <code>/domains/1/nameservers/</code> gives me all nameservers I have, not only one related to domain#1</p>
  <p>I think the problem is that I use default tutorial NameServerViewSet implementation</p>
  <pre><code>class NameserverViewSet(viewsets.ModelViewSet):
      queryset = Nameserver.objects.all()
      serializer_class = NameserverSerializer
  </code></pre>
  <p>Please help me code it right way.</p>
  <p>Below are examples from <a href="https://github.com/alanjds/drf-nested-routers" rel="nofollow noreferrer">drf-nested-routers github page</a>.</p>
  <p>drf-nested-routers provides nested router that generates url patterns below</p>
  <blockquote>
  <p>\domain\ &lt;- Domains list \domain{pk}\ &lt;- One domain, from {pk]</p>
  <p>\domain{domain_pk}\nameservers\ &lt;- Nameservers of domain from</p>
  <p>{domain_pk} \domain{domain_pk}\nameservers\ {pk}\ &lt;- Specific nameserver from {pk}, of domain from {domain_pk}</p>
  </blockquote>
  <p>Here is an example:</p>
  <pre><code># urls.py
  from rest_framework_nested import routers
  from views import DomainViewSet, NameserverViewSet
  (...)
  
  router = routers.SimpleRouter()
  router.register(r'domains', DomainViewSet)
  
  domains_router = routers.NestedSimpleRouter(router, r'domains', lookup='domain')
  domains_router.register(r'nameservers', NameserverViewSet)
  
  urlpatterns = patterns('',
      url(r'^', include(router.urls)),
      url(r'^', include(domains_router.urls)),
  )
  </code></pre>