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/5-relationships-and-hyperlinked-apis.html | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'tutorial/5-relationships-and-hyperlinked-apis.html') diff --git a/tutorial/5-relationships-and-hyperlinked-apis.html b/tutorial/5-relationships-and-hyperlinked-apis.html index fccbfaaa..250a3d52 100644 --- a/tutorial/5-relationships-and-hyperlinked-apis.html +++ b/tutorial/5-relationships-and-hyperlinked-apis.html @@ -293,8 +293,8 @@ class UserSerializer(serializers.HyperlinkedModelSerializer):

After adding all those names into our URLconf, our final snippets/urls.py file should look something like this:

# API endpoints
-urlpatterns = format_suffix_patterns(patterns('snippets.views',
-    url(r'^$', 'api_root'),
+urlpatterns = format_suffix_patterns([
+    url(r'^$', views.api_root),
     url(r'^snippets/$',
         views.SnippetList.as_view(),
         name='snippet-list'),
@@ -310,13 +310,13 @@ urlpatterns = format_suffix_patterns(patterns('snippets.views',
     url(r'^users/(?P<pk>[0-9]+)/$',
         views.UserDetail.as_view(),
         name='user-detail')
-))
+])
 
 # Login and logout views for the browsable API
-urlpatterns += patterns('',
+urlpatterns += [
     url(r'^api-auth/', include('rest_framework.urls',
                                namespace='rest_framework')),
-)
+]
 

Adding pagination

The list views for users and code snippets could end up returning quite a lot of instances, so really we'd like to make sure we paginate the results, and allow the API client to step through each of the individual pages.

-- cgit v1.2.3