From ccb2b8ff691760e4e93f3905975b285cee8b67f8 Mon Sep 17 00:00:00 2001 From: Xavier Ordoquy Date: Tue, 10 Feb 2015 23:56:05 +0100 Subject: Update documentation --- tutorial/1-serialization/index.html | 2 +- tutorial/2-requests-and-responses/index.html | 2 +- tutorial/5-relationships-and-hyperlinked-apis/index.html | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) (limited to 'tutorial') diff --git a/tutorial/1-serialization/index.html b/tutorial/1-serialization/index.html index 6782a94c..b9aae2a0 100644 --- a/tutorial/1-serialization/index.html +++ b/tutorial/1-serialization/index.html @@ -487,7 +487,7 @@ from snippets.models import Snippet, LANGUAGE_CHOICES, STYLE_CHOICES class SnippetSerializer(serializers.Serializer): pk = serializers.IntegerField(read_only=True) title = serializers.CharField(required=False, allow_blank=True, max_length=100) - code = serializers.CharField(style={'type': 'textarea'}) + code = serializers.CharField(style={'base_template': 'textarea.html'}) linenos = serializers.BooleanField(required=False) language = serializers.ChoiceField(choices=LANGUAGE_CHOICES, default='python') style = serializers.ChoiceField(choices=STYLE_CHOICES, default='friendly') 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):
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.
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.
+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.
def snippet_list(request, format=None):
diff --git a/tutorial/5-relationships-and-hyperlinked-apis/index.html b/tutorial/5-relationships-and-hyperlinked-apis/index.html
index 39b8dd42..488bcb4a 100644
--- a/tutorial/5-relationships-and-hyperlinked-apis/index.html
+++ b/tutorial/5-relationships-and-hyperlinked-apis/index.html
@@ -512,7 +512,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 settings.py file slightly. Add the following setting:
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
}
--
cgit v1.2.3