cineclub-site/server/myapi/renderers.py

16 lines
395 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):
2022-04-03 01:20:54 +02:00
media_type = "text/plain"
format = "txt"
2022-04-03 01:20:54 +02:00
def render(self, data, media_type=None, renderer_context=None):
return smart_str(data, encoding=self.charset)
2022-04-03 01:20:54 +02:00
2022-04-03 01:20:54 +02:00
class LatexRenderer(PlainTextRenderer):
2022-04-03 01:20:54 +02:00
media_type = "text/x-tex"
format = "tex"