diff options
| author | Tom Christie | 2014-11-03 11:21:29 +0000 |
|---|---|---|
| committer | Tom Christie | 2014-11-03 11:21:29 +0000 |
| commit | dd14c6c88ba210bac8349041b8db486576539249 (patch) | |
| tree | 81b1e22fb8080a8d3915ae6a5db95edf87a3bfb6 /tutorial/5-relationships-and-hyperlinked-apis.html | |
| parent | ce165805481988e95887bf62c45cd616af5bba0f (diff) | |
| download | django-rest-framework-dd14c6c88ba210bac8349041b8db486576539249.tar.bz2 | |
Latest docs release
Diffstat (limited to 'tutorial/5-relationships-and-hyperlinked-apis.html')
| -rw-r--r-- | tutorial/5-relationships-and-hyperlinked-apis.html | 10 |
1 files changed, 5 insertions, 5 deletions
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): </ul> <p>After adding all those names into our URLconf, our final <code>snippets/urls.py</code> file should look something like this:</p> <pre class="prettyprint lang-py"><code># 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')), -) +] </code></pre> <h2 id="adding-pagination">Adding pagination</h2> <p>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.</p> |
