From 5933c1271501e8244c388dd7569f435319db48e8 Mon Sep 17 00:00:00 2001 From: Rob Terhaar Date: Mon, 2 Dec 2013 19:19:47 -0500 Subject: [PATCH] Add the "name=" parameter in the urls.py for the tutorial --- docs/tutorial/5-relationships-and-hyperlinked-apis.md | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/docs/tutorial/5-relationships-and-hyperlinked-apis.md b/docs/tutorial/5-relationships-and-hyperlinked-apis.md index 2cf44bf99..de0c5132d 100644 --- a/docs/tutorial/5-relationships-and-hyperlinked-apis.md +++ b/docs/tutorial/5-relationships-and-hyperlinked-apis.md @@ -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