|
|
@ -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)
|
|
|
|
|
|
|
|
|
|
|
|