title: How to replace or edit the lookup parameter in a django rest framework Router?
body: <p>I have set up a Django Rest Framework <code>ModelViewSet</code> for a Product model. The Product has a <code>uuid4</code> primary key field. The API list views are working, but I can't access the detail views using the default router, I guess because the <code>uuid4</code> primary key doesn't fit the <code>pk</code> integer regex the router expects? The error is a <code>TypeError</code> in <code>python3.6/site-packages/rest_framework/viewsets.py</code>:</p>
  
  <blockquote>
    <p>retrieve() got an unexpected keyword argument 'pk'</p>
  </blockquote>
  
  <p><a href="http://www.django-rest-framework.org/api-guide/routers/#custom-routers" rel="nofollow noreferrer">From the router documentation</a>, I believe I need a custom router, but I don't understand how to replace the <code>{lookup}</code> field from an integer pk regex to a uuid4 regex <code>(?P&lt;uuid&gt;[a-f0-9]{8}-?[a-f0-9]{4}-?4[a-f0-9]{3}-?[89ab][a-f0-9]{3}-?[a-f0-9]{12})</code>. I think the relevant part of the source code is <a href="https://github.com/encode/django-rest-framework/blob/master/rest_framework/routers.py#L227" rel="nofollow noreferrer">here</a>.</p>
  
  <p>My present url config is as follows:</p>
  
  <pre><code>from .views.API.product import ProductViewSet
  from django.conf.urls import include
  from rest_framework.routers import DefaultRouter
  
  router = DefaultRouter()
  router.register(r'product', ProductViewSet, base_name='product')
  urlpatterns += [
      url(r'^API/0.1/', include(router.urls)),
  ]
  </code></pre>