Allow passing inline to not only GET requests.

This commit is contained in:
Tom Hacohen 2020-04-16 11:35:58 +03:00
parent a72543f6c9
commit ca7d7dfd12

View File

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