Format extensions have already been introduced.

If format extensions are used,
they must be used in the creation of the
reverse URLs.
This commit is contained in:
Richard Wackerbarth 2013-01-13 10:49:49 -06:00
parent 9d47c32f44
commit 08943c3e0a

View File

@ -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.