It didn't work exactly the way I was hoping. I can't just add 
`lookup_value_regex` to the `@detail_route`, it needs to be part of the 
viewset.

MyViewSet(viewsets.ViewSet):
    lookup_field = 'blah'
    lookup_value_regex = 'pattern'

if I don't have these in my viewset then I get an error:

>TypeError:MyViewSet() received an invalid keyword 'lookup_value_regex'
>   Fiel "~/myproject/myproject/myapp/urls.py", line 92, in <module>
>     url(r'^', include(router.urls)),
>   File 
"/home/applmgr/.local/lib/python2.7/site-packages/rest_framework/routers.py", 
line 82, in urls
>     self._urls = self.get_urls()
>   File "~/.local/lib/python2.7/site-packages/rest_framework/routers.py", 
line 373, in get_urls
>     urls = super(DefaultRouter, self).get_urls()
>   File "~/.local/lib/python2.7/site-packages/rest_framework/routers.py", 
line 271, in get_urls
>     view = viewset.as_view(mapping, **route.initkwargs)
>   File "~/.local/lib/python2.7/site-packages/rest_framework/viewsets.py", 
line 67, in as_view
>     cls.__name__, key))

but what I want is an _additional_ endpoint so I can lookup records by 
either pk _or_ uuid.

-- 
You received this message because you are subscribed to the Google Groups 
"Django REST framework" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-rest-framework+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to