From 3ce41cad46135af413754b08e8c55f63e272cda0 Mon Sep 17 00:00:00 2001 From: johnthagen Date: Thu, 27 Dec 2018 09:36:09 -0500 Subject: [PATCH 1/4] Update quickstart to Django 2.0 routing syntax --- docs/tutorial/quickstart.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/tutorial/quickstart.md b/docs/tutorial/quickstart.md index de007f521b..8a830d73f7 100644 --- a/docs/tutorial/quickstart.md +++ b/docs/tutorial/quickstart.md @@ -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(r'', include(router.urls)), + path(r'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. From c9769420618c63f858567af3b4290f668d0e418f Mon Sep 17 00:00:00 2001 From: johnthagen Date: Thu, 27 Dec 2018 09:44:47 -0500 Subject: [PATCH 2/4] Remove uneccessary raw string identifiers --- docs/tutorial/quickstart.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/tutorial/quickstart.md b/docs/tutorial/quickstart.md index 8a830d73f7..6ec5b23a53 100644 --- a/docs/tutorial/quickstart.md +++ b/docs/tutorial/quickstart.md @@ -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 = [ - path(r'', include(router.urls)), - path(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. From 66674aec5167a24878a28414c835a8444796a655 Mon Sep 17 00:00:00 2001 From: johnthagen Date: Thu, 27 Dec 2018 10:18:57 -0500 Subject: [PATCH 3/4] Correctly import path function --- docs/tutorial/quickstart.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/tutorial/quickstart.md b/docs/tutorial/quickstart.md index 6ec5b23a53..8359b9af63 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.conf.urls import include, path from rest_framework import routers from tutorial.quickstart import views From 5d2700307c724f2aa70787d70619d2514693064f Mon Sep 17 00:00:00 2001 From: johnthagen Date: Thu, 27 Dec 2018 10:21:13 -0500 Subject: [PATCH 4/4] Fix import path to use django.urls This is what is prescribed in the Django 2.1 tutorial --- docs/tutorial/quickstart.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/tutorial/quickstart.md b/docs/tutorial/quickstart.md index 8359b9af63..cbec2501bf 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 include, path + from django.urls import include, path from rest_framework import routers from tutorial.quickstart import views