aboutsummaryrefslogtreecommitdiffstats
path: root/tutorial/2-requests-and-responses/index.html
diff options
context:
space:
mode:
authorEsmail2015-03-11 11:01:10 -0400
committerEsmail2015-03-11 11:01:10 -0400
commitf723091ee907b5783723348b64c37d5d93751f18 (patch)
tree65a27481341bad4c8b997f7f3e954599e60ed2c5 /tutorial/2-requests-and-responses/index.html
parent1d65378886990a1dc5c36403d454ce251fbda457 (diff)
downloaddjango-rest-framework-f723091ee907b5783723348b64c37d5d93751f18.tar.bz2
Fix example of explicit format URL.
The link is displayed in the tutorial as "http://example.com/api/items/4.json" but the hyperlink itself and what the example code actually works with are (in my opinion, less pretty) URLs like "http://example.com/api/items/4/.json".
Diffstat (limited to 'tutorial/2-requests-and-responses/index.html')
-rw-r--r--tutorial/2-requests-and-responses/index.html4
1 files changed, 2 insertions, 2 deletions
diff --git a/tutorial/2-requests-and-responses/index.html b/tutorial/2-requests-and-responses/index.html
index df43617a..7357244b 100644
--- a/tutorial/2-requests-and-responses/index.html
+++ b/tutorial/2-requests-and-responses/index.html
@@ -473,7 +473,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 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>
@@ -608,4 +608,4 @@ http --json POST http://127.0.0.1:8000/snippets/ code="print 456"
</script>
</body>
-</html> \ No newline at end of file
+</html>