diff --git a/backend/api/serializers.py b/backend/api/serializers.py index 443d458..c109132 100644 --- a/backend/api/serializers.py +++ b/backend/api/serializers.py @@ -39,7 +39,7 @@ class StockSerializer(serializers.ModelSerializer): class StockCreateSerializer(serializers.ModelSerializer): class Meta: model = models.Stock - fields = ('user', 'ticker', 'quantity',) + fields = ('ticker', 'quantity',) class CharitySerializer(serializers.ModelSerializer): class Meta: diff --git a/backend/api/views.py b/backend/api/views.py index af1639f..1d9ed93 100644 --- a/backend/api/views.py +++ b/backend/api/views.py @@ -38,7 +38,8 @@ class StockViewSet(ModelViewSet): def create(self, request, *args, **kwargs): - data = QueryDict.copy(request.data) + import copy + data = copy.deepcopy(request.data) data.update({'user': request.user}) serializer = StockCreateSerializer(data=request.data) serializer.is_valid(raise_exception=True) @@ -81,4 +82,4 @@ class BuyRobinhoodStock(APIView): for key, value in stonks.items(): print(key) print(value) - return Response(stonks) \ No newline at end of file + return Response(stonks)