Skip to content

Commit

Permalink
fix: check action on currency viewset to avoid unwanted operations
Browse files Browse the repository at this point in the history
  • Loading branch information
PauloUbirajara committed Apr 28, 2024
1 parent f6c45a1 commit c539d90
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions apps/currency/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ def get_queryset(self):
if not self.request.user.is_authenticated:
raise NotAuthenticated()

if self.action not in ("list", "retrieve"):
raise NotImplementedError()

queryset = Currency.objects.filter()
return queryset

Expand Down Expand Up @@ -60,9 +63,3 @@ def retrieve(self, request, *args, **kwargs):
serializer = serializer_class(currency)

return Response(data=serializer.data)

def update(self, request, *args, **kwargs):
return Response(status=HTTPStatus.UNAUTHORIZED)

def delete(self, request, *args, **kwargs):
return Response(status=HTTPStatus.UNAUTHORIZED)

0 comments on commit c539d90

Please sign in to comment.