mirror of
https://github.com/encode/django-rest-framework.git
synced 2024-11-22 17:47:04 +03:00
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:
parent
9d47c32f44
commit
08943c3e0a
|
@ -15,8 +15,8 @@ Right now we have endpoints for 'snippets' and 'users', but we don't have a sing
|
|||
@api_view(('GET',))
|
||||
def api_root(request, format=None):
|
||||
return Response({
|
||||
'users': reverse('user-list', request=request),
|
||||
'snippets': reverse('snippet-list', request=request)
|
||||
'users': reverse('user-list', request=request, format=format),
|
||||
'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.
|
||||
|
|
Loading…
Reference in New Issue
Block a user