From d9f541836b243ef94c8df616a0d5b683414547f7 Mon Sep 17 00:00:00 2001 From: Chris Shyi Date: Fri, 22 Jun 2018 04:28:59 -0400 Subject: [PATCH] Update to Django 2.0 Routing Syntax (#6049) --- docs/tutorial/6-viewsets-and-routers.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/tutorial/6-viewsets-and-routers.md b/docs/tutorial/6-viewsets-and-routers.md index ff458e2067..1d40588135 100644 --- a/docs/tutorial/6-viewsets-and-routers.md +++ b/docs/tutorial/6-viewsets-and-routers.md @@ -105,7 +105,7 @@ Because we're using `ViewSet` classes rather than `View` classes, we actually do Here's our re-wired `snippets/urls.py` file. - from django.conf.urls import url, include + from django.urls import path, include from rest_framework.routers import DefaultRouter from snippets import views @@ -116,7 +116,7 @@ Here's our re-wired `snippets/urls.py` file. # The API URLs are now determined automatically by the router. urlpatterns = [ - url(r'^', include(router.urls)) + path('', include(router.urls)), ] Registering the viewsets with the router is similar to providing a urlpattern. We include two arguments - the URL prefix for the views, and the viewset itself.