From 64638152cab1a4ead868e981053325527156e6df Mon Sep 17 00:00:00 2001 From: tsurutan Date: Thu, 30 Jan 2020 18:15:35 +0900 Subject: [PATCH] fix api guide custom render example --- docs/api-guide/renderers.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/api-guide/renderers.md b/docs/api-guide/renderers.md index a3321e860..a508a9ff9 100644 --- a/docs/api-guide/renderers.md +++ b/docs/api-guide/renderers.md @@ -273,7 +273,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. - from django.utils.encoding import smart_unicode + from django.utils.encoding import smart_text from rest_framework import renderers @@ -282,7 +282,7 @@ The following is an example plaintext renderer that will return a response with format = 'txt' def render(self, data, media_type=None, renderer_context=None): - return data.encode(self.charset) + return smart_text(data, encoding=self.charset) ## Setting the character set