Skip to content

Commit 0c8eb91

Browse files
authored
Fixed docs' custom render example. (#7171)
1 parent a7a3628 commit 0c8eb91

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

docs/api-guide/renderers.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@ By default this will include the following keys: `view`, `request`, `response`,
273273

274274
The following is an example plaintext renderer that will return a response with the `data` parameter as the content of the response.
275275

276-
from django.utils.encoding import smart_unicode
276+
from django.utils.encoding import smart_text
277277
from rest_framework import renderers
278278

279279

@@ -282,7 +282,7 @@ The following is an example plaintext renderer that will return a response with
282282
format = 'txt'
283283

284284
def render(self, data, media_type=None, renderer_context=None):
285-
return data.encode(self.charset)
285+
return smart_text(data, encoding=self.charset)
286286

287287
## Setting the character set
288288

0 commit comments

Comments
 (0)