我有这两个类:
class Person(db.Model):
person_name = db.StringProperty(required = True)
#gender = db.StringProperty(required = True)
nacionality = db.StringProperty(required = True)
marital_status = db.StringProperty(required = True)
profession = db.StringProperty(required = True)
SSN = db.IntegerProperty(required = True)
driver_license = db.IntegerProperty(required = True)
address = db.PostalAddressProperty(required = True)
class ContractingParty(db.Model):
person = db.ReferenceProperty(Person, required=True, collection_name="party_to_contracts")
contract = db.ReferenceProperty(Contract, required=True)
condition = db.StringProperty()
我想将 ContractingParty 实体的查询传递给我的 jinja2 模板。然后使用 a for loop
,我想从 Person 实体访问我真正想要的数据。缔约方查询正在传递给 jinja2(如果我测试它,我可以看到类似这样的内容:)[<main.ContractingParty object at 0x0492D770>]
。但是for loop
波纹管不起作用,for loop
我的browser中没有显示任何信息。我该如何解决?
{% for party in parties %}
<li> {{party.person.person_name}} </li>
{% endfor %}