From d6df94facf6c5015ef2373c2739c9bd3c4fe09c2 Mon Sep 17 00:00:00 2001 From: Tom Hacohen Date: Wed, 26 Feb 2020 14:20:23 +0200 Subject: [PATCH] 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. --- django_etesync/views.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/django_etesync/views.py b/django_etesync/views.py index d8604cc..4c744bd 100644 --- a/django_etesync/views.py +++ b/django_etesync/views.py @@ -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)