Item create: 404 if collection isn't found.

It doesn't actually change anything beacuse it 404s in the
collection getting, but still, good to have this here too.
pull/56/head
Tom Hacohen 4 years ago
parent cc00391504
commit d6df94facf

@ -121,7 +121,7 @@ class CollectionItemViewSet(BaseViewSet):
return queryset
def create(self, request, collection_uid=None):
collection_object = self.get_collection_queryset(Collection.objects).get(uid=collection_uid)
collection_object = get_object_or_404(self.get_collection_queryset(Collection.objects), uid=collection_uid)
many = isinstance(request.data, list)
serializer = self.serializer_class(data=request.data, many=many)

Loading…
Cancel
Save