1
0
mirror of https://github.com/etesync/server synced 2024-11-26 02:38:15 +00:00

Implement prefer-inline for fetching items.

This commit is contained in:
Tom Hacohen 2020-02-20 12:30:20 +02:00
parent 0a3bb6f4bb
commit 4075f775e7

View File

@ -99,6 +99,12 @@ class CollectionItemViewSet(BaseViewSet):
pagination_class = paginators.LinkHeaderPagination pagination_class = paginators.LinkHeaderPagination
lookup_field = 'uid' lookup_field = 'uid'
def get_serializer_class(self):
if self.request.method == 'GET' and self.request.query_params.get('prefer_inline'):
return CollectionItemInlineSerializer
return super().get_serializer_class()
def get_queryset(self): def get_queryset(self):
collection_uid = self.kwargs['collection_uid'] collection_uid = self.kwargs['collection_uid']
try: try: