From b0a1712ebd2eeb9dfe17d0e2f7e1abd7000cfa15 Mon Sep 17 00:00:00 2001 From: Xavier Ordoquy Date: Wed, 28 Jan 2015 00:08:01 +0100 Subject: Update documentation --- api-guide/routers/index.html | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'api-guide') 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
Alternatively you can use Django's include function, like so…
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)),
 ]
 Router URL patterns can also be namespaces.
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')),
 ]
 If using namespacing with hyperlinked serializers you'll also need to ensure that any view_name parameters on the serializers correctly reflect the namespace. In the example above you'd need to include a parameter such as view_name='api:user-detail' for serializer fields hyperlinked to the user detail view.