diff --git a/cinema/views.py b/cinema/views.py index 87c2235f3..12ae4de6c 100644 --- a/cinema/views.py +++ b/cinema/views.py @@ -26,12 +26,9 @@ def get(self, request): def post(self, request): serializer = GenreSerializer(data=request.data) - - if serializer.is_valid(): - serializer.save() - return Response( - serializer.data, status=status.HTTP_201_CREATED - ) + serializer.is_valid(raise_exception=True) + serializer.save() + return Response(serializer.data, status=status.HTTP_201_CREATED) class GenreDetail(APIView):