def update_account_view(request): try: account = request.user except Account.DoesNotExist: return Response(status=status.HTTP_404_NOT_FOUND) serializer = AccountPropertiesSerializer(account, data=request.data) data = {} if serializer.is_valid(): serializer.save() data['response'] = "account updated successfully" return Response(data=data) return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST)
def account_update_view(request): try: account = request.user except Account.DoesNotExist: return Response(status=status.HTTP_404_NOT_FOUND) if request.method == 'PUT': serializer = AccountPropertiesSerializer(account, data=request.data) data = {} if serializer.is_valid(): serializer.save() data['response'] = "Account Update Success" return Response(data=data) return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST)
def profile_update(request): try: account = request.user except Account.DoesNotExist: return Response(status=status.HTTP_404_NOT_FOUND) if request.method == "PUT": serializer = AccountPropertiesSerializer(account, data=request.data) data = {} if serializer.is_valid(): serializer.save() data["response"] = "Account update success" return Response(data=data) return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST)