From dd14c6c88ba210bac8349041b8db486576539249 Mon Sep 17 00:00:00 2001 From: Tom Christie Date: Mon, 3 Nov 2014 11:21:29 +0000 Subject: Latest docs release --- tutorial/1-serialization.html | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'tutorial/1-serialization.html') diff --git a/tutorial/1-serialization.html b/tutorial/1-serialization.html index 9c50a584..94145642 100644 --- a/tutorial/1-serialization.html +++ b/tutorial/1-serialization.html @@ -256,9 +256,9 @@ cd tutorial )
We also need to wire up the root urlconf, in the tutorial/urls.py file, to include our snippet app's URLs.
urlpatterns = patterns('',
+urlpatterns = [
url(r'^', include('snippets.urls')),
-)
+]
Okay, we're ready to roll.
Creating a model to work with
@@ -459,11 +459,12 @@ def snippet_detail(request, pk):
Finally we need to wire these views up. Create the snippets/urls.py file:
from django.conf.urls import patterns, url
+from snippets import views
-urlpatterns = patterns('snippets.views',
- url(r'^snippets/$', 'snippet_list'),
- url(r'^snippets/(?P<pk>[0-9]+)/$', 'snippet_detail'),
-)
+urlpatterns = [
+ url(r'^snippets/$', views.snippet_list),
+ url(r'^snippets/(?P<pk>[0-9]+)/$', views.snippet_detail),
+]
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.