Commit 08943c3e by Richard Wackerbarth

Format extensions have already been introduced.

If format extensions are used,
they must be used in the creation of the
reverse URLs.
parent 9d47c32f
...@@ -15,8 +15,8 @@ Right now we have endpoints for 'snippets' and 'users', but we don't have a sing ...@@ -15,8 +15,8 @@ Right now we have endpoints for 'snippets' and 'users', but we don't have a sing
@api_view(('GET',)) @api_view(('GET',))
def api_root(request, format=None): def api_root(request, format=None):
return Response({ return Response({
'users': reverse('user-list', request=request), 'users': reverse('user-list', request=request, format=format),
'snippets': reverse('snippet-list', request=request) 'snippets': reverse('snippet-list', request=request, format=format)
}) })
Notice that we're using REST framework's `reverse` function in order to return fully-qualified URLs. Notice that we're using REST framework's `reverse` function in order to return fully-qualified URLs.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment