Views: fix wrong items name.

This commit is contained in:
Tom Hacohen 2020-05-19 15:28:20 +03:00
parent ae4aafcf96
commit e851fb9877

View File

@ -268,14 +268,14 @@ class CollectionItemViewSet(BaseViewSet):
if ser_valid and deps_ser_valid: if ser_valid and deps_ser_valid:
try: try:
with transaction.atomic(): with transaction.atomic():
collections = serializer.save(collection=collection_object) items = serializer.save(collection=collection_object)
except IntegrityError: except IntegrityError:
# FIXME: should return the items with a bad token (including deps) so we don't have to fetch them after # FIXME: should return the items with a bad token (including deps) so we don't have to fetch them after
content = {'code': 'integrity_error'} content = {'code': 'integrity_error'}
return Response(content, status=status.HTTP_400_BAD_REQUEST) return Response(content, status=status.HTTP_400_BAD_REQUEST)
ret = { ret = {
"data": [collection.stoken for collection in collections], "data": [item.stoken for item in items],
} }
return Response(ret, status=status.HTTP_200_OK) return Response(ret, status=status.HTTP_200_OK)