aboutsummaryrefslogtreecommitdiffstats
path: root/docs/api-guide/parsers.md
diff options
context:
space:
mode:
authorJosé Padilla2014-11-29 14:43:05 -0400
committerJosé Padilla2014-11-29 14:43:05 -0400
commit731c8421afe3093a78cdabb9c3cc28fa52cd1c8e (patch)
treebcbcfcfb32d0ab0e59605a5564cf320913767d6d /docs/api-guide/parsers.md
parent3a5b3772fefc3c2f2c0899947cbc07bfe6e6b5d2 (diff)
downloaddjango-rest-framework-731c8421afe3093a78cdabb9c3cc28fa52cd1c8e.tar.bz2
Remove YAML support from core
Diffstat (limited to 'docs/api-guide/parsers.md')
-rw-r--r--docs/api-guide/parsers.md24
1 files changed, 8 insertions, 16 deletions
diff --git a/docs/api-guide/parsers.md b/docs/api-guide/parsers.md
index 73e3a705..1e134c77 100644
--- a/docs/api-guide/parsers.md
+++ b/docs/api-guide/parsers.md
@@ -26,26 +26,26 @@ As an example, if you are sending `json` encoded data using jQuery with the [.aj
## Setting the parsers
-The default set of parsers may be set globally, using the `DEFAULT_PARSER_CLASSES` setting. For example, the following settings would allow requests with `YAML` content.
+The default set of parsers may be set globally, using the `DEFAULT_PARSER_CLASSES` setting. For example, the following settings would allow requests with `JSON` content.
REST_FRAMEWORK = {
'DEFAULT_PARSER_CLASSES': (
- 'rest_framework.parsers.YAMLParser',
+ 'rest_framework.parsers.JSONParser',
)
}
You can also set the parsers used for an individual view, or viewset,
using the `APIView` class based views.
- from rest_framework.parsers import YAMLParser
+ from rest_framework.parsers import JSONParser
from rest_framework.response import Response
from rest_framework.views import APIView
class ExampleView(APIView):
"""
- A view that can accept POST requests with YAML content.
+ A view that can accept POST requests with JSON content.
"""
- parser_classes = (YAMLParser,)
+ parser_classes = (JSONParser,)
def post(self, request, format=None):
return Response({'received data': request.data})
@@ -53,10 +53,10 @@ using the `APIView` class based views.
Or, if you're using the `@api_view` decorator with function based views.
@api_view(['POST'])
- @parser_classes((YAMLParser,))
+ @parser_classes((JSONParser,))
def example_view(request, format=None):
"""
- A view that can accept POST requests with YAML content.
+ A view that can accept POST requests with JSON content.
"""
return Response({'received data': request.data})
@@ -70,14 +70,6 @@ Parses `JSON` request content.
**.media_type**: `application/json`
-## YAMLParser
-
-Parses `YAML` request content.
-
-Requires the `pyyaml` package to be installed.
-
-**.media_type**: `application/yaml`
-
## XMLParser
Parses REST framework's default style of `XML` request content.
@@ -161,7 +153,7 @@ By default this will include the following keys: `view`, `request`, `args`, `kwa
## Example
-The following is an example plaintext parser that will populate the `request.data` property with a string representing the body of the request.
+The following is an example plaintext parser that will populate the `request.data` property with a string representing the body of the request.
class PlainTextParser(BaseParser):
"""