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 に答える