Rename prefer_inline to inline.

master
Tom Hacohen 5 years ago
parent 6711cfcf49
commit 2e018dfe76

@ -62,8 +62,8 @@ class CollectionContentField(BinaryBase64Field):
class ChunksField(serializers.RelatedField):
def to_representation(self, obj):
prefer_inline = self.context.get('prefer_inline', False)
if prefer_inline:
inline = self.context.get('inline', False)
if inline:
with open(obj.chunkFile.path, 'rb') as f:
return (obj.uid, b64encode(f.read()))
else:

@ -67,8 +67,8 @@ class CollectionViewSet(BaseViewSet):
def get_serializer_context(self):
context = super().get_serializer_context()
prefer_inline = self.request.method == 'GET' and 'prefer_inline' in self.request.query_params
context.update({'request': self.request, 'prefer_inline': prefer_inline})
inline = self.request.method == 'GET' and 'inline' in self.request.query_params
context.update({'request': self.request, 'inline': inline})
return context
def destroy(self, request, uid=None):
@ -118,8 +118,8 @@ class CollectionItemViewSet(BaseViewSet):
def get_serializer_context(self):
context = super().get_serializer_context()
prefer_inline = self.request.method == 'GET' and 'prefer_inline' in self.request.query_params
context.update({'request': self.request, 'prefer_inline': prefer_inline})
inline = self.request.method == 'GET' and 'inline' in self.request.query_params
context.update({'request': self.request, 'inline': inline})
return context
def create(self, request, collection_uid=None):

Loading…
Cancel
Save