Skip to content

Commit

Permalink
fixed serializers
Browse files Browse the repository at this point in the history
  • Loading branch information
Helen Chen committed Jul 18, 2020
1 parent 3cf6ecb commit 114413f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion bboyapp/api/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@
class UserProfileSerializer(serializers.ModelSerializer):
class Meta:
model = UserProfile
fields = ('username', 'email', 'moveList', 'setList', 'probs', 'durations')
fields = ('username', 'email', 'userId', 'moveList', 'setList', 'probs', 'durations')
8 changes: 4 additions & 4 deletions bboyapp/api/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,28 +11,28 @@ class UserProfileViewSet(viewsets.ModelViewSet):

@action(methods=['post'], detail=True, url_path='updateMoves', url_name='updateMoves')
def updateMoves(self, request, *args, **kwargs):
currentUser = UserProfile.objects.get(pk=request.data.get("username"))
currentUser = UserProfile.objects.get(pk=request.data.get("userId"))
currentUser.moveList = request.data.get("moveList")
currentUser.save()
return Response()

@action(methods=['post'], detail=True, url_path='updateSets', url_name='updateSets')
def updateSets(self, request, *args, **kwargs):
currentUser = UserProfile.objects.get(pk=request.data.get("username"))
currentUser = UserProfile.objects.get(pk=request.data.get("userId"))
currentUser.setList = request.data.get("setList")
currentUser.save()
return Response()

@action(methods=['post'], detail=True, url_path='updateProbabilities', url_name='updateProbabilities')
def updateProbabilities(self, request, *args, **kwargs):
currentUser = UserProfile.objects.get(pk=request.data.get("username"))
currentUser = UserProfile.objects.get(pk=request.data.get("userId"))
currentUser.probs = request.data.get("probs")
currentUser.save()
return Response()

@action(methods=['post'], detail=True, url_path='updateDurations', url_name='updateDurations')
def updateDurations(self, request, *args, **kwargs):
currentUser = UserProfile.objects.get(pk=request.data.get("username"))
currentUser = UserProfile.objects.get(pk=request.data.get("userId"))
currentUser.durations = request.data.get("durations")
currentUser.save()
return Response()
Expand Down

0 comments on commit 114413f

Please sign in to comment.