Equivalent replacement for ListProperty(db.Key) in djangoappengine
I and trying to use djangoappengine, but I am unsure how can I write model to incorporate standard
ListProperty(db.Key)
I know that djangotoolbox provides this field types but I am unable to fig开发者_运维问答ure out the exact syntax.
db.ListProperty(db.Key) stores a list of any entity's keys.
models:
class Profile(db.Model):
data_list=db.ListProperty(db.Key)
class Data(db.Model):
name=db.StringProperty()
views:
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
精彩评论