aboutsummaryrefslogtreecommitdiffstats
path: root/tutorial/2-requests-and-responses/index.html
diff options
context:
space:
mode:
authorTom Christie2015-03-06 12:05:16 +0000
committerTom Christie2015-03-06 12:05:16 +0000
commite628d9eb9b7deac2ecffe23eace5c72709887f8f (patch)
treedce4031c10381afca0631824eb741e135b78c160 /tutorial/2-requests-and-responses/index.html
parentccb2b8ff691760e4e93f3905975b285cee8b67f8 (diff)
downloaddjango-rest-framework-e628d9eb9b7deac2ecffe23eace5c72709887f8f.tar.bz2
Update documentation
Diffstat (limited to 'tutorial/2-requests-and-responses/index.html')
-rw-r--r--tutorial/2-requests-and-responses/index.html30
1 files changed, 11 insertions, 19 deletions
diff --git a/tutorial/2-requests-and-responses/index.html b/tutorial/2-requests-and-responses/index.html
index cbc9c596..df43617a 100644
--- a/tutorial/2-requests-and-responses/index.html
+++ b/tutorial/2-requests-and-responses/index.html
@@ -189,6 +189,10 @@
</li>
<li >
+ <a href="../../api-guide/versioning">Versioning</a>
+ </li>
+
+ <li >
<a href="../../api-guide/content-negotiation">Content negotiation</a>
</li>
@@ -232,6 +236,10 @@
</li>
<li >
+ <a href="../../topics/internationalization">Internationalization</a>
+ </li>
+
+ <li >
<a href="../../topics/ajax-csrf-cors">AJAX, CSRF & CORS</a>
</li>
@@ -260,23 +268,11 @@
</li>
<li >
- <a href="../../topics/rest-framework-2-announcement">2.0 Announcement</a>
- </li>
-
- <li >
- <a href="../../topics/2.2-announcement">2.2 Announcement</a>
- </li>
-
- <li >
- <a href="../../topics/2.3-announcement">2.3 Announcement</a>
- </li>
-
- <li >
- <a href="../../topics/2.4-announcement">2.4 Announcement</a>
+ <a href="../../topics/3.0-announcement">3.0 Announcement</a>
</li>
<li >
- <a href="../../topics/3.0-announcement">3.0 Announcement</a>
+ <a href="../../topics/3.1-announcement">3.1 Announcement</a>
</li>
<li >
@@ -287,10 +283,6 @@
<a href="../../topics/release-notes">Release Notes</a>
</li>
- <li >
- <a href="../../topics/credits">Credits</a>
- </li>
-
</ul>
</li>
@@ -479,7 +471,7 @@ def snippet_detail(request, pk):
return Response(status=status.HTTP_204_NO_CONTENT)
</code></pre>
<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>
+<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>Start by adding a <code>format</code> keyword argument to both of the views, like so.</p>