如何在google appengine db model
中实现这一点
from google.appengine.ext import db
Class Car(db.Model):
name=db.StringProperty()
model=db.StringProperty()
mileage=db.IntegerProperty()
Class Person(db.Model):
name=db.StringProperty()
age=db.IntegerProperty()
cars=db.ListProperty(Car) # How can I have cars object for person containing list of Car Objects?
谢谢
查看参考文档http://code.google.com/appengine/docs/python/datastore/datamodeling.html#References
反过来也可以,类Car会有
person = db.ReferenceProperty(Person, collection_name="cars")
将使属性cars在Person中可用。