mirror of
https://github.com/encode/django-rest-framework.git
synced 2024-11-10 19:56:59 +03:00
Update renderers documentation example (#9362)
This commit is contained in:
parent
085b7e166b
commit
63063da082
|
@ -283,7 +283,7 @@ By default this will include the following keys: `view`, `request`, `response`,
|
||||||
|
|
||||||
The following is an example plaintext renderer that will return a response with the `data` parameter as the content of the response.
|
The following is an example plaintext renderer that will return a response with the `data` parameter as the content of the response.
|
||||||
|
|
||||||
from django.utils.encoding import smart_text
|
from django.utils.encoding import smart_str
|
||||||
from rest_framework import renderers
|
from rest_framework import renderers
|
||||||
|
|
||||||
|
|
||||||
|
@ -292,7 +292,7 @@ The following is an example plaintext renderer that will return a response with
|
||||||
format = 'txt'
|
format = 'txt'
|
||||||
|
|
||||||
def render(self, data, accepted_media_type=None, renderer_context=None):
|
def render(self, data, accepted_media_type=None, renderer_context=None):
|
||||||
return smart_text(data, encoding=self.charset)
|
return smart_str(data, encoding=self.charset)
|
||||||
|
|
||||||
## Setting the character set
|
## Setting the character set
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user