diff options
| author | Tom Christie | 2014-09-24 09:02:53 +0100 |
|---|---|---|
| committer | Tom Christie | 2014-09-24 09:02:53 +0100 |
| commit | 4ffae7c0e959e42fa2dde830ac144e94ee8aae71 (patch) | |
| tree | eb878800eb479fdf072b8315282ec2b1fdea8ba2 /docs/tutorial/1-serialization.md | |
| parent | 8495cd898a5d34f00858a379b54e39cd19ded215 (diff) | |
| parent | da385c9c1f9deeeefd705154a6e6612d6d62f41b (diff) | |
| download | django-rest-framework-4ffae7c0e959e42fa2dde830ac144e94ee8aae71.tar.bz2 | |
Merge pull request #1899 from collinanderson/urls
Remove patterns and strings from urls in tutorial.
Diffstat (limited to 'docs/tutorial/1-serialization.md')
| -rw-r--r-- | docs/tutorial/1-serialization.md | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/docs/tutorial/1-serialization.md b/docs/tutorial/1-serialization.md index 96214f5b..b0565d91 100644 --- a/docs/tutorial/1-serialization.md +++ b/docs/tutorial/1-serialization.md @@ -64,9 +64,9 @@ We'll also need to add our new `snippets` app and the `rest_framework` app to `I 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. @@ -297,11 +297,12 @@ We'll also need a view which corresponds to an individual snippet, and can be us 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. |
