UUID is not JSON serializable django-rest-framework 解决方法


解决方法 序列化中指定类型

class positionSerializer(serializers.ModelSerializer):
    id = serializers.UUIDField()
    class Meta:
        model = Position
        fields = '__all__'

解决方法出处 https://github.com/encode/django-rest-framework/issues/2426