def create(self, request, *args, **kwargs): serializer = BatchFileSerializer(data=request.data) if serializer.is_valid(): batch_file = serializer.create() serializer = BatchFileSerializer(instance=batch_file) return Response(data=serializer.data, status=status.HTTP_201_CREATED) else: return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST)
def create(self, request, *args, **kwargs): serializer = BatchFileSerializer(data=request.data) if serializer.is_valid(): batch_file = serializer.create() serializer = BatchFileSerializer(instance=batch_file) return Response(data=serializer.data, status=status.HTTP_201_CREATED) else: raise serializers.ValidationError(detail=serializer.errors)
def create(self, request, *args, **kwargs): serializer = BatchFileSerializer(data=request.data) if serializer.is_valid(): batch_file = serializer.create() serializer = BatchFileSerializer(instance=batch_file) return Response(data=serializer.data, status=status.HTTP_201_CREATED) else: raise serializers.ValidationError(detail=serializer.errors)
def create(self, request, *args, **kwargs): serializer = BatchFileSerializer(data=request.data) if serializer.is_valid(): batch_file = serializer.create() serializer = BatchFileSerializer(instance=batch_file) return Response(data=serializer.data, status=status.HTTP_201_CREATED) else: return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST)