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:
>Typ
Hi Alex,
Got it - make sure the keyword args are exactly the same, so use shared_key for
both the decorator and the underlying function.
Thanks!
--
You received this message because you are subscribed to the Google Groups
"Django REST framework" group.
To unsubscribe from this group and stop re
Yes, you can, but don't forget to name kwarg in function same as lookup
field
@detail_route(lookup_field='shared_key',lookup_regex='[0-9a-f]{32}')
def get_weather_by_key(self, request, shared_key=None):
return Response(Weather.objects.get(shared_key=shared_key)
--
You received this message