def update_user(user, request): serializer = CustomUserSerializer(user, data=request.data, partial=True) if serializer.is_valid(raise_exception=True): return serializer.save()
def create_user(request): serializer = CustomUserSerializer(data=request.data) if serializer.is_valid(raise_exception=True): return serializer.save()