mirror of
https://github.com/Rushilwiz/reinvest.git
synced 2025-04-04 12:30:20 -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 Meta:
|
||||
model = models.Stock
|
||||
fields = ('user', 'ticker', 'quantity',)
|
||||
fields = ('ticker', 'quantity',)
|
||||
|
||||
class CharitySerializer(serializers.ModelSerializer):
|
||||
class Meta:
|
||||
|
|
|
@ -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)
|
||||
return Response(stonks)
|
||||
|
|
Loading…
Reference in New Issue
Block a user