Skip to content

Commit 44ae037

Browse files
committed
Move urls.py changes down and add necessary import
The previous location of editting urls.py did not allow migrations to be created and the default import needs to be modified
1 parent e3274af commit 44ae037

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

docs/tutorial/1-serialization.md

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -48,12 +48,6 @@ We'll need to add our new `snippets` app and the `rest_framework` app to `INSTAL
4848
'snippets',
4949
)
5050

51-
We also need to wire up the root urlconf, in the `tutorial/urls.py` file, to include our snippet app's URLs.
52-
53-
urlpatterns = [
54-
url(r'^', include('snippets.urls')),
55-
]
56-
5751
Okay, we're ready to roll.
5852

5953
## Creating a model to work with
@@ -299,6 +293,14 @@ Finally we need to wire these views up. Create the `snippets/urls.py` file:
299293
url(r'^snippets/$', views.snippet_list),
300294
url(r'^snippets/(?P<pk>[0-9]+)/$', views.snippet_detail),
301295
]
296+
297+
We also need to wire up the root urlconf, in the `tutorial/urls.py` file, to include our snippet app's URLs.
298+
299+
from django.conf.urls import url, include
300+
301+
urlpatterns = [
302+
url(r'^', include('snippets.urls')),
303+
]
302304

303305
It's worth noting that there are a couple of edge cases we're not dealing with properly at the moment. If we send malformed `json`, or if a request is made with a method that the view doesn't handle, then we'll end up with a 500 "server error" response. Still, this'll do for now.
304306

0 commit comments

Comments
 (0)