aboutsummaryrefslogtreecommitdiffstats
path: root/tutorial/2-requests-and-responses
diff options
context:
space:
mode:
authorXavier Ordoquy2015-02-10 23:56:05 +0100
committerXavier Ordoquy2015-02-10 23:56:05 +0100
commitccb2b8ff691760e4e93f3905975b285cee8b67f8 (patch)
treef841204e1818f09c91e062e4bdedefe2732c65c1 /tutorial/2-requests-and-responses
parentb0a1712ebd2eeb9dfe17d0e2f7e1abd7000cfa15 (diff)
downloaddjango-rest-framework-ccb2b8ff691760e4e93f3905975b285cee8b67f8.tar.bz2
Update documentation
Diffstat (limited to 'tutorial/2-requests-and-responses')
-rw-r--r--tutorial/2-requests-and-responses/index.html2
1 files changed, 1 insertions, 1 deletions
diff --git a/tutorial/2-requests-and-responses/index.html b/tutorial/2-requests-and-responses/index.html
index 0f4980a7..cbc9c596 100644
--- a/tutorial/2-requests-and-responses/index.html
+++ b/tutorial/2-requests-and-responses/index.html
@@ -481,7 +481,7 @@ def snippet_detail(request, pk):
<p>This should all feel very familiar - it is not a lot different from working with regular Django views.</p>
<p>Notice that we're no longer explicitly tying our requests or responses to a given content type. <code>request.data</code> can handle incoming <code>json</code> requests, but it can also handle <code>yaml</code> and other formats. Similarly we're returning response objects with data, but allowing REST framework to render the response into the correct content type for us.</p>
<h2 id="adding-optional-format-suffixes-to-our-urls">Adding optional format suffixes to our URLs</h2>
-<p>To take advantage of the fact that our responses are no longer hardwired to a single content type let's add support for format suffixes to our API endpoints. Using format suffixes gives us URLs that explicitly refer to a given format, and means our API will be able to handle URLs such as <a href="http://example.com/api/items/4.json">http://example.com/api/items/4.json</a>.</p>
+<p>To take advantage of the fact that our responses are no longer hardwired to a single content type let's add support for format suffixes to our API endpoints. Using format suffixes gives us URLs that explicitly refer to a given format, and means our API will be able to handle URLs such as <a href="http://example.com/api/items/4.json">http://example.com/api/items/4/.json</a>.</p>
<p>Start by adding a <code>format</code> keyword argument to both of the views, like so.</p>
<pre><code>def snippet_list(request, format=None):
</code></pre>