Django rest framework: Get detail view using a field other than primary key integer id : <p>My Product model has an extra field named "product_id" which is a uuid string. Now I can get the product details based on the primary key id. I want to change this to get the product details using "product_id" field.</p>

<p>My current urls.py</p>

<pre><code>url(r'^products/(?P&lt;pk&gt;[0-9]+)/$', views.ProductDetailCustom.as_view(), name='product-detail'),
</code></pre>

<p>Now am calling like this.</p>

<pre><code>http://127.0.0.1:8000/api/v1/products/1460
</code></pre>

<p>I want this should be like this.</p>

<pre><code>http://127.0.0.1:8000/api/v1/products/04396134-3c90-ea7b-24ba-1fb0db11dbe5
</code></pre>

<p>views.py</p>

<pre><code>class ProductDetailCustom(generics.RetrieveAPIView):
    queryset = Product.objects.all()
    serializer_class = ProductCustomSerializer
</code></pre>

<p>serializer.py</p>

<pre><code>class ProductCustomSerializer(serializers.ModelSerializer):

    class Meta:
        model = Product
        fields =  ('url', 'id','product_id', 'title', 'description','structure','date_created',)
</code></pre>

<p>I think I have to include a look field to achive this.</p>
