0

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 figure out the exact syntax.

Nitin
  • 738
  • 6
  • 19

1 Answers1

1

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
Lennart Regebro
  • 167,292
  • 41
  • 224
  • 251
Abdul Kader
  • 5,781
  • 4
  • 22
  • 40