From f8b639c4401273d485917d0c9c34ca1a4d72375e Mon Sep 17 00:00:00 2001 From: johnthagen Date: Tue, 8 Jan 2019 06:53:51 -0500 Subject: [PATCH] Update quickstart to Django 2.0 routing syntax (#6385) * Update quickstart to Django 2.0 routing syntax * Remove uneccessary raw string identifiers * Correctly import path function * Fix import path to use django.urls This is what is prescribed in the Django 2.1 tutorial --- docs/tutorial/quickstart.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/tutorial/quickstart.md b/docs/tutorial/quickstart.md index de007f521ba..cbec2501bf8 100644 --- a/docs/tutorial/quickstart.md +++ b/docs/tutorial/quickstart.md @@ -111,7 +111,7 @@ We can easily break these down into individual views if we need to, but using vi Okay, now let's wire up the API URLs. On to `tutorial/urls.py`... - from django.conf.urls import url, include + from django.urls import include, path from rest_framework import routers from tutorial.quickstart import views @@ -122,8 +122,8 @@ Okay, now let's wire up the API URLs. On to `tutorial/urls.py`... # Wire up our API using automatic URL routing. # Additionally, we include login URLs for the browsable API. urlpatterns = [ - url(r'^', include(router.urls)), - url(r'^api-auth/', include('rest_framework.urls', namespace='rest_framework')) + path('', include(router.urls)), + path('api-auth/', include('rest_framework.urls', namespace='rest_framework')) ] Because we're using viewsets instead of views, we can automatically generate the URL conf for our API, by simply registering the viewsets with a router class.