如果我有下表:
class Ticket(BaseModel):
event = ForeignKeyField(Event)
category = ForeignKeyField(TicketCategory)
order_number = IntegerField()
tier_name = CharField()
num_available = IntegerField()
price = DecimalField()
然后我执行以下代码:
tickets = Ticket.select()
for ticket in tickets:
print ticket.event.id
访问外来对象的主键是否会强制 peewee 启动另一个查询?还是 peewee 足够聪明,可以知道 id 已经可用?