From e628d9eb9b7deac2ecffe23eace5c72709887f8f Mon Sep 17 00:00:00 2001
From: Tom Christie
Date: Fri, 6 Mar 2015 12:05:16 +0000
Subject: Update documentation
---
tutorial/1-serialization/index.html | 28 ++++++++------------
tutorial/2-requests-and-responses/index.html | 30 ++++++++--------------
tutorial/3-class-based-views/index.html | 28 ++++++++------------
.../4-authentication-and-permissions/index.html | 28 ++++++++------------
.../index.html | 30 ++++++++--------------
tutorial/6-viewsets-and-routers/index.html | 28 ++++++++------------
tutorial/quickstart/index.html | 30 ++++++++--------------
7 files changed, 73 insertions(+), 129 deletions(-)
(limited to 'tutorial')
diff --git a/tutorial/1-serialization/index.html b/tutorial/1-serialization/index.html
index b9aae2a0..8746083a 100644
--- a/tutorial/1-serialization/index.html
+++ b/tutorial/1-serialization/index.html
@@ -188,6 +188,10 @@
Pagination
+
+ Versioning
+
+
Content negotiation
@@ -231,6 +235,10 @@
Documenting your API
+
+ Internationalization
+
+
AJAX, CSRF & CORS
@@ -260,23 +268,11 @@
- 2.0 Announcement
-
-
-
- 2.2 Announcement
-
-
-
- 2.3 Announcement
-
-
-
- 2.4 Announcement
+ 3.0 Announcement
- 3.0 Announcement
+ 3.1 Announcement
@@ -287,10 +283,6 @@
Release Notes
-
- Credits
-
-
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
@@ -188,6 +188,10 @@
Pagination
+
+ Versioning
+
+
Content negotiation
@@ -231,6 +235,10 @@
Documenting your API
+
+ Internationalization
+
+
AJAX, CSRF & CORS
@@ -260,23 +268,11 @@
- 2.0 Announcement
-
-
-
- 2.2 Announcement
-
-
-
- 2.3 Announcement
-
-
-
- 2.4 Announcement
+ 3.0 Announcement
- 3.0 Announcement
+ 3.1 Announcement
@@ -287,10 +283,6 @@
Release Notes
-
- Credits
-
-
@@ -479,7 +471,7 @@ def snippet_detail(request, pk):
return Response(status=status.HTTP_204_NO_CONTENT)
This should all feel very familiar - it is not a lot different from working with regular Django views.
-Notice that we're no longer explicitly tying our requests or responses to a given content type. request.data can handle incoming json requests, but it can also handle yaml 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.
+Notice that we're no longer explicitly tying our requests or responses to a given content type. request.data can handle incoming json 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.
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 http://example.com/api/items/4/.json.
Start by adding a format keyword argument to both of the views, like so.
diff --git a/tutorial/3-class-based-views/index.html b/tutorial/3-class-based-views/index.html
index 03263869..49488f2a 100644
--- a/tutorial/3-class-based-views/index.html
+++ b/tutorial/3-class-based-views/index.html
@@ -188,6 +188,10 @@
Pagination
+
+ Versioning
+
+
Content negotiation
@@ -231,6 +235,10 @@
Documenting your API
+
+ Internationalization
+
+
AJAX, CSRF & CORS
@@ -260,23 +268,11 @@
- 2.0 Announcement
-
-
-
- 2.2 Announcement
-
-
-
- 2.3 Announcement
-
-
-
- 2.4 Announcement
+ 3.0 Announcement
- 3.0 Announcement
+ 3.1 Announcement
@@ -287,10 +283,6 @@
Release Notes
-
- Credits
-
-
diff --git a/tutorial/4-authentication-and-permissions/index.html b/tutorial/4-authentication-and-permissions/index.html
index e4e5fccc..7b1007d6 100644
--- a/tutorial/4-authentication-and-permissions/index.html
+++ b/tutorial/4-authentication-and-permissions/index.html
@@ -188,6 +188,10 @@
Pagination
+
+ Versioning
+
+
Content negotiation
@@ -231,6 +235,10 @@
Documenting your API
+
+ Internationalization
+
+
AJAX, CSRF & CORS
@@ -260,23 +268,11 @@
- 2.0 Announcement
-
-
-
- 2.2 Announcement
-
-
-
- 2.3 Announcement
-
-
-
- 2.4 Announcement
+ 3.0 Announcement
- 3.0 Announcement
+ 3.1 Announcement
@@ -287,10 +283,6 @@
Release Notes
-
- Credits
-
-
diff --git a/tutorial/5-relationships-and-hyperlinked-apis/index.html b/tutorial/5-relationships-and-hyperlinked-apis/index.html
index 488bcb4a..418c7851 100644
--- a/tutorial/5-relationships-and-hyperlinked-apis/index.html
+++ b/tutorial/5-relationships-and-hyperlinked-apis/index.html
@@ -188,6 +188,10 @@
Pagination
+
+ Versioning
+
+
Content negotiation
@@ -231,6 +235,10 @@
Documenting your API
+
+ Internationalization
+
+
AJAX, CSRF & CORS
@@ -260,23 +268,11 @@
- 2.0 Announcement
-
-
-
- 2.2 Announcement
-
-
-
- 2.3 Announcement
-
-
-
- 2.4 Announcement
+ 3.0 Announcement
- 3.0 Announcement
+ 3.1 Announcement
@@ -287,10 +283,6 @@
Release Notes
-
- Credits
-
-
@@ -514,7 +506,7 @@ urlpatterns += [
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.
We can change the default list style to use pagination, by modifying our tutorial/settings.py file slightly. Add the following setting:
REST_FRAMEWORK = {
- 'PAGINATE_BY': 10
+ 'PAGE_SIZE': 10
}
Note that settings in REST framework are all namespaced into a single dictionary setting, named 'REST_FRAMEWORK', which helps keep them well separated from your other project settings.
diff --git a/tutorial/6-viewsets-and-routers/index.html b/tutorial/6-viewsets-and-routers/index.html
index 254ab791..3127cdf3 100644
--- a/tutorial/6-viewsets-and-routers/index.html
+++ b/tutorial/6-viewsets-and-routers/index.html
@@ -188,6 +188,10 @@
Pagination
+
+ Versioning
+
+
Content negotiation
@@ -231,6 +235,10 @@
Documenting your API
+
+ Internationalization
+
+
AJAX, CSRF & CORS
@@ -260,23 +268,11 @@
- 2.0 Announcement
-
-
-
- 2.2 Announcement
-
-
-
- 2.3 Announcement
-
-
-
- 2.4 Announcement
+ 3.0 Announcement
- 3.0 Announcement
+ 3.1 Announcement
@@ -287,10 +283,6 @@
Release Notes
-
- Credits
-
-
diff --git a/tutorial/quickstart/index.html b/tutorial/quickstart/index.html
index 80e36829..3d0f15b5 100644
--- a/tutorial/quickstart/index.html
+++ b/tutorial/quickstart/index.html
@@ -188,6 +188,10 @@
Pagination
+
+ Versioning
+
+
Content negotiation
@@ -231,6 +235,10 @@
Documenting your API
+
+ Internationalization
+
+
AJAX, CSRF & CORS
@@ -260,23 +268,11 @@
- 2.0 Announcement
-
-
-
- 2.2 Announcement
-
-
-
- 2.3 Announcement
-
-
-
- 2.4 Announcement
+ 3.0 Announcement
- 3.0 Announcement
+ 3.1 Announcement
@@ -287,10 +283,6 @@
Release Notes
-
- Credits
-
-
@@ -496,7 +488,7 @@ urlpatterns = [
REST_FRAMEWORK = {
'DEFAULT_PERMISSION_CLASSES': ('rest_framework.permissions.IsAdminUser',),
- 'PAGINATE_BY': 10
+ 'PAGE_SIZE': 10
}
Okay, we're done.
--
cgit v1.2.3