API: File upload infrastructure

This commit is contained in:
Raphael Michel
2021-01-05 12:49:58 +01:00
parent 9d70fd675c
commit 8b08b43e77
6 changed files with 149 additions and 1 deletions

View File

@@ -0,0 +1,11 @@
from rest_framework.renderers import BaseRenderer
class UploadRenderer(BaseRenderer):
media_type = None
format = 'upload'
charset = 'utf-8'
def render(self, data, accepted_media_type=None, renderer_context=None):
self.media_type = data['media_type']
return data['file']