Also serve an item's snapshots.
This commit is contained in:
parent
b17e944dd2
commit
24cb6ed6ee
@ -34,6 +34,8 @@ from .serializers import (
|
|||||||
CollectionSerializer,
|
CollectionSerializer,
|
||||||
CollectionItemSerializer,
|
CollectionItemSerializer,
|
||||||
CollectionItemInlineSerializer,
|
CollectionItemInlineSerializer,
|
||||||
|
CollectionItemSnapshotSerializer,
|
||||||
|
CollectionItemSnapshotInlineSerializer,
|
||||||
CollectionItemChunkSerializer
|
CollectionItemChunkSerializer
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -146,6 +148,14 @@ class CollectionItemViewSet(BaseViewSet):
|
|||||||
# FIXME: implement, or should it be implemented elsewhere?
|
# FIXME: implement, or should it be implemented elsewhere?
|
||||||
return Response(status=status.HTTP_405_METHOD_NOT_ALLOWED)
|
return Response(status=status.HTTP_405_METHOD_NOT_ALLOWED)
|
||||||
|
|
||||||
|
@action_decorator(detail=True, methods=['GET'])
|
||||||
|
def snapshots(self, request, collection_uid=None, uid=None):
|
||||||
|
col = get_object_or_404(Collection.objects, uid=collection_uid)
|
||||||
|
col_it = get_object_or_404(col.items, uid=uid)
|
||||||
|
|
||||||
|
serializer = CollectionItemSnapshotSerializer(col_it.snapshots, many=True)
|
||||||
|
return Response(serializer.data)
|
||||||
|
|
||||||
|
|
||||||
class CollectionItemChunkViewSet(viewsets.ViewSet):
|
class CollectionItemChunkViewSet(viewsets.ViewSet):
|
||||||
allowed_methods = ['GET', 'POST']
|
allowed_methods = ['GET', 'POST']
|
||||||
|
Loading…
Reference in New Issue
Block a user