aboutsummaryrefslogtreecommitdiffstats
path: root/api-guide
diff options
context:
space:
mode:
authorXavier Ordoquy2015-01-28 00:08:01 +0100
committerXavier Ordoquy2015-01-28 00:08:01 +0100
commitb0a1712ebd2eeb9dfe17d0e2f7e1abd7000cfa15 (patch)
treecf34206e9070c4689a290559cfd0352158ac3060 /api-guide
parent987880e13138a93d9cc0e44b7ed30297909f7b03 (diff)
downloaddjango-rest-framework-b0a1712ebd2eeb9dfe17d0e2f7e1abd7000cfa15.tar.bz2
Update documentation
Diffstat (limited to 'api-guide')
-rw-r--r--api-guide/routers/index.html10
1 files changed, 5 insertions, 5 deletions
diff --git a/api-guide/routers/index.html b/api-guide/routers/index.html
index cc7bad73..4e27a86a 100644
--- a/api-guide/routers/index.html
+++ b/api-guide/routers/index.html
@@ -483,21 +483,21 @@ router.register(r'users', UserViewSet)
router.register(r'accounts', AccountViewSet)
urlpatterns = [
- url(r'^forgot-password/$', ForgotPasswordFormView.as_view(),
+ url(r'^forgot-password/$', ForgotPasswordFormView.as_view()),
]
urlpatterns += router.urls
</code></pre>
<p>Alternatively you can use Django's <code>include</code> function, like so…</p>
<pre><code>urlpatterns = [
- url(r'^forgot-password/$', ForgotPasswordFormView.as_view(),
- url(r'^', include(router.urls))
+ url(r'^forgot-password/$', ForgotPasswordFormView.as_view()),
+ url(r'^', include(router.urls)),
]
</code></pre>
<p>Router URL patterns can also be namespaces.</p>
<pre><code>urlpatterns = [
- url(r'^forgot-password/$', ForgotPasswordFormView.as_view(),
- url(r'^api/', include(router.urls, namespace='api'))
+ url(r'^forgot-password/$', ForgotPasswordFormView.as_view()),
+ url(r'^api/', include(router.urls, namespace='api')),
]
</code></pre>
<p>If using namespacing with hyperlinked serializers you'll also need to ensure that any <code>view_name</code> parameters on the serializers correctly reflect the namespace. In the example above you'd need to include a parameter such as <code>view_name='api:user-detail'</code> for serializer fields hyperlinked to the user detail view.</p>