cineclub-site/server/myapi/renderers.py

15 lines
394 B
Python
Raw Normal View History

2022-04-03 01:20:54 +02:00
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'