mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-08-02 11:30:12 +03:00
Add the "name=" parameter in the urls.py for the tutorial
This commit is contained in:
parent
01040b077c
commit
5933c12715
|
@ -19,7 +19,14 @@ Right now we have endpoints for 'snippets' and 'users', but we don't have a sing
|
|||
'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. We must add a `name=` parameter to urls.py so that Django can assosciate these URL routes. In your `urls.py` add the `name=` parameter to the Users and Snippets base url.
|
||||
|
||||
url(r'^snippets/$', views.SnippetList.as_view(), name='snippet-list'),
|
||||
|
||||
and
|
||||
|
||||
url(r'^users/$', views.UserList.as_view(), name='user-list'),
|
||||
|
||||
|
||||
## Creating an endpoint for the highlighted snippets
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user