mirror of
https://github.com/Rushilwiz/reinvest.git
synced 2025-04-04 20:40:19 -04:00
fix(backend): fixed buying api
This commit is contained in:
parent
2e51f0904f
commit
d2d085fba9
|
@ -39,7 +39,7 @@ class StockSerializer(serializers.ModelSerializer):
|
||||||
class StockCreateSerializer(serializers.ModelSerializer):
|
class StockCreateSerializer(serializers.ModelSerializer):
|
||||||
class Meta:
|
class Meta:
|
||||||
model = models.Stock
|
model = models.Stock
|
||||||
fields = ('user', 'ticker', 'quantity',)
|
fields = ('ticker', 'quantity',)
|
||||||
|
|
||||||
class CharitySerializer(serializers.ModelSerializer):
|
class CharitySerializer(serializers.ModelSerializer):
|
||||||
class Meta:
|
class Meta:
|
||||||
|
|
|
@ -38,7 +38,8 @@ class StockViewSet(ModelViewSet):
|
||||||
|
|
||||||
|
|
||||||
def create(self, request, *args, **kwargs):
|
def create(self, request, *args, **kwargs):
|
||||||
data = QueryDict.copy(request.data)
|
import copy
|
||||||
|
data = copy.deepcopy(request.data)
|
||||||
data.update({'user': request.user})
|
data.update({'user': request.user})
|
||||||
serializer = StockCreateSerializer(data=request.data)
|
serializer = StockCreateSerializer(data=request.data)
|
||||||
serializer.is_valid(raise_exception=True)
|
serializer.is_valid(raise_exception=True)
|
||||||
|
@ -81,4 +82,4 @@ class BuyRobinhoodStock(APIView):
|
||||||
for key, value in stonks.items():
|
for key, value in stonks.items():
|
||||||
print(key)
|
print(key)
|
||||||
print(value)
|
print(value)
|
||||||
return Response(stonks)
|
return Response(stonks)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user