Skip to content

Commit

Permalink
Added return invalid patch, added status 200
Browse files Browse the repository at this point in the history
  • Loading branch information
nyanplague committed Oct 10, 2023
1 parent 1422aa7 commit 6e4178e
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions cinema/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,16 +94,17 @@ def put(self, request, pk):

if serializer.is_valid():
serializer.save()
return Response(serializer.data)
return Response(serializer.data, status=status.HTTP_200_OK)

return Response(serializer.data, status=status.HTTP_400_BAD_REQUEST)
return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST)

def patch(self, request, pk):
genre = self.get_object(pk)
serializer = GenreSerializer(genre, data=request.data, partial=True)
if serializer.is_valid():
serializer.save()
return Response(serializer.data, status=status.HTTP_200_OK)
return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST)

def delete(self, request, pk):
genre = self.get_object(pk)
Expand Down

0 comments on commit 6e4178e

Please sign in to comment.