15 lines
395 B
Python
15 lines
395 B
Python
from django.utils.encoding import smart_str
|
|
from rest_framework import renderers
|
|
|
|
|
|
class PlainTextRenderer(renderers.BaseRenderer):
|
|
media_type = "text/plain"
|
|
format = "txt"
|
|
|
|
def render(self, data, media_type=None, renderer_context=None):
|
|
return smart_str(data, encoding=self.charset)
|
|
|
|
|
|
class LatexRenderer(PlainTextRenderer):
|
|
media_type = "text/x-tex"
|
|
format = "tex"
|