我正在尝试使用djangoappengine,但我不确定如何编写模型来结合标准
ListProperty(db.Key)
我知道djangotoolbox提供了这个字段类型,但我无法弄清楚确切的语法。
发布于 2011-01-19 20:11:43
db.ListProperty(db.Key)存储任何实体的键的列表。
型号:
class Profile(db.Model):
data_list=db.ListProperty(db.Key)
class Data(db.Model):
name=db.StringProperty()
视图:
prof=Profile()
data=Data.all()
for data in data:
prof.data_list.append(data)
/// Here data_list stores the keys of Data entity
Data.get(prof.data_list) will get all the Data entities whose key are in the data_list attribute
https://stackoverflow.com/questions/3352489
复制相似问题