0

我并尝试使用djangoappengine,但我不确定如何编写模型来合并标准

ListProperty(db.Key) 

我知道 djangotoolbox 提供了这种字段类型,但我无法弄清楚确切的语法。

4

1 回答 1

1

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
于 2011-01-19T12:11:42.853 回答