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:
try:
with transaction.atomic():
collections = serializer.save(collection=collection_object)
items = serializer.save(collection=collection_object)
except IntegrityError:
# FIXME: should return the items with a bad token (including deps) so we don't have to fetch them after
content = {'code': 'integrity_error'}
return Response(content, status=status.HTTP_400_BAD_REQUEST)
ret = {
"data": [collection.stoken for collection in collections],
"data": [item.stoken for item in items],
}
return Response(ret, status=status.HTTP_200_OK)