Skip to content

Commit

Permalink
Update to Django 2.0 Routing Syntax (#6049)
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisshyi authored and carltongibson committed Jun 22, 2018
1 parent 1a17043 commit d9f5418
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions docs/tutorial/6-viewsets-and-routers.md
Expand Up @@ -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

Expand All @@ -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.
Expand Down

0 comments on commit d9f5418

Please sign in to comment.