diff options
| author | Tom Christie | 2015-01-05 12:26:15 +0000 | 
|---|---|---|
| committer | Tom Christie | 2015-01-05 12:26:15 +0000 | 
| commit | 17665aa52a9cd5599099c19fd8f54540a5d436ce (patch) | |
| tree | 5d9bab5947ec47ffbd93bb88a4bdcca8db6a622f /docs/api-guide/renderers.md | |
| parent | 6168f60ba80a84768172437c09957c1fab05f014 (diff) | |
| download | django-rest-framework-17665aa52a9cd5599099c19fd8f54540a5d436ce.tar.bz2 | |
Add docs for OAuth, XML, YAML, JSONP packages. Closes #2179.
Diffstat (limited to 'docs/api-guide/renderers.md')
| -rw-r--r-- | docs/api-guide/renderers.md | 80 | 
1 files changed, 78 insertions, 2 deletions
| diff --git a/docs/api-guide/renderers.md b/docs/api-guide/renderers.md index 69460dbc..83ded849 100644 --- a/docs/api-guide/renderers.md +++ b/docs/api-guide/renderers.md @@ -342,13 +342,81 @@ Templates will render with a `RequestContext` which includes the `status_code` a  The following third party packages are also available. +## YAML + +[REST framework YAML][rest-framework-yaml] provides [YAML][yaml] parsing and rendering support. It was previously included directly in the REST framework package, and is now instead supported as a third-party package. + +#### Installation & configuration + +Install using pip. + +    $ pip install djangorestframework-yaml + +Modify your REST framework settings. + +    REST_FRAMEWORK = { +        'DEFAULT_PARSER_CLASSES': ( +            'rest_framework_yaml.parsers.YAMLParser', +        ), +        'DEFAULT_RENDERER_CLASSES': ( +            'rest_framework_yaml.renderers.YAMLRenderer', +        ), +    } + +## XML + +[REST Framework XML][rest-framework-xml] provides a simple informal XML format. It was previously included directly in the REST framework package, and is now instead supported as a third-party package. + +#### Installation & configuration + +Install using pip. + +    $ pip install djangorestframework-xml + +Modify your REST framework settings. + +    REST_FRAMEWORK = { +        'DEFAULT_PARSER_CLASSES': ( +            'rest_framework_xml.parsers.XMLParser', +        ), +        'DEFAULT_RENDERER_CLASSES': ( +            'rest_framework_xml.renderers.XMLRenderer', +        ), +    } + +## JSONP + +[REST framework JSONP][rest-framework-jsonp] provides JSONP rendering support. It was previously included directly in the REST framework package, and is now instead supported as a third-party package. + +--- + +**Warning**: If you require cross-domain AJAX requests, you should generally be using the more modern approach of [CORS][cors] as an alternative to `JSONP`. See the [CORS documentation][cors-docs] for more details. + +The `jsonp` approach is essentially a browser hack, and is [only appropriate for globally readable API endpoints][jsonp-security], where `GET` requests are unauthenticated and do not require any user permissions. + +--- + +#### Installation & configuration + +Install using pip. + +    $ pip install djangorestframework-jsonp + +Modify your REST framework settings. + +    REST_FRAMEWORK = { +        'DEFAULT_RENDERER_CLASSES': ( +            'rest_framework_yaml.renderers.JSONPRenderer', +        ), +    } +  ## MessagePack  [MessagePack][messagepack] is a fast, efficient binary serialization format.  [Juan Riaza][juanriaza] maintains the [djangorestframework-msgpack][djangorestframework-msgpack] package which provides MessagePack renderer and parser support for REST framework.  ## CSV -Comma-separated values are a plain-text tabular data format, that can be easily imported into spreadsheet applications.  [Mjumbe Poe][mjumbewu] maintains the [djangorestframework-csv][djangorestframework-csv] package which provides CSV renderer support for REST framework. +Comma-separated values are a plain-text tabular data format, that can be easily imported into spreadsheet applications. [Mjumbe Poe][mjumbewu] maintains the [djangorestframework-csv][djangorestframework-csv] package which provides CSV renderer support for REST framework.  ## UltraJSON @@ -358,7 +426,6 @@ Comma-separated values are a plain-text tabular data format, that can be easily  [djangorestframework-camel-case] provides camel case JSON renderers and parsers for REST framework.  This allows serializers to use Python-style underscored field names, but be exposed in the API as Javascript-style camel case field names.  It is maintained by [Vitaly Babiy][vbabiy]. -  ## Pandas (CSV, Excel, PNG)  [Django REST Pandas] provides a serializer and renderers that support additional data processing and output via the [Pandas] DataFrame API.  Django REST Pandas includes renderers for Pandas-style CSV files, Excel workbooks (both `.xls` and `.xlsx`), and a number of [other formats]. It is maintained by [S. Andrew Sheppard][sheppard] as part of the [wq Project][wq]. @@ -373,10 +440,19 @@ Comma-separated values are a plain-text tabular data format, that can be easily  [application/vnd.github+json]: http://developer.github.com/v3/media/  [application/vnd.collection+json]: http://www.amundsen.com/media-types/collection/  [django-error-views]: https://docs.djangoproject.com/en/dev/topics/http/views/#customizing-error-views +[rest-framework-jsonp]: http://jpadilla.github.io/django-rest-framework-jsonp/ +[cors]: http://www.w3.org/TR/cors/ +[cors-docs]: http://www.django-rest-framework.org/topics/ajax-csrf-cors/ +[jsonp-security]: http://stackoverflow.com/questions/613962/is-jsonp-safe-to-use +[rest-framework-yaml]: http://jpadilla.github.io/django-rest-framework-yaml/ +[rest-framework-xml]: http://jpadilla.github.io/django-rest-framework-xml/  [messagepack]: http://msgpack.org/  [juanriaza]: https://github.com/juanriaza  [mjumbewu]: https://github.com/mjumbewu  [vbabiy]: https://github.com/vbabiy +[rest-framework-yaml]: http://jpadilla.github.io/django-rest-framework-yaml/ +[rest-framework-xml]: http://jpadilla.github.io/django-rest-framework-xml/ +[yaml]: http://www.yaml.org/  [djangorestframework-msgpack]: https://github.com/juanriaza/django-rest-framework-msgpack  [djangorestframework-csv]: https://github.com/mjumbewu/django-rest-framework-csv  [ultrajson]: https://github.com/esnme/ultrajson | 
