Skip to content

Commit a09d60e

Browse files
author
Gabriel Monroy
committed
switch to get_object_or_404 on layer views
1 parent 4a9ed1a commit a09d60e

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

api/views.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
from rest_framework.response import Response
1616
from rest_framework.status import HTTP_400_BAD_REQUEST, HTTP_201_CREATED
1717
import json
18+
from rest_framework.generics import get_object_or_404
1819

1920
class AnonymousAuthentication(BaseAuthentication):
2021

@@ -237,7 +238,7 @@ def get_queryset(self, **kwargs):
237238

238239
def get_object(self, *args, **kwargs):
239240
qs = self.get_queryset(**kwargs)
240-
obj = qs.get(id=self.kwargs['layer'])
241+
obj = get_object_or_404(qs, id=self.kwargs['layer'])
241242
return obj
242243

243244
def create(self, request, **kwargs):

0 commit comments

Comments
 (0)