我在python文件中有以下三个类,显然我在customerOrder(第3行)出现错误,因为它尚未定义 - 类是使用uml到python工具(witchcraftmda)生成的,是否有python模块自动命令类,以便依赖类自动向上移动 - 或任何其他python技巧(我是新手)。
class CustomerSerializer(serializers.ModelSerializer):
displayName = serializers.ReadOnlyField()
customerOrder = CustomerOrderSerializer(many=True)
class Meta:
model = Customer
class CustomerOrderSerializer(serializers.ModelSerializer):
displayName = serializers.ReadOnlyField()
customer = CustomerLookupSerializer
orderItems = OrderItemSerializer(many=True)
class Meta:
model = CustomerOrder
class OrderItemSerializer(serializers.ModelSerializer):
displayName = serializers.ReadOnlyField()
customerOrder = CustomerOrderLookupSerializer
product = ProductLookupSerializer
class Meta:
model = OrderItem