Are there examples of how to pass a list of key_names to Model.get_or_insert()
?
My Problem:
With a method of ParentLayer I want to make the children.
The key_names of the new (or editable) entities of class Child will come from such a list below:
namesList = ["picture1","picture2"]
so I should be able to build a list of key_names with method from the parent class as follows:
class ParentLayer(db.Model):
def getOrMakeChildren(self, namesList):
keyslist = [ db.Key.from_path( 'Child' , name , parent = self.key() ) for name in namesList ]
the problem is next where I simply want to get_or_insert entities based on keylist
defined above:
childrenEntitiesList = Child.get_or_insert(keyslist) # no works?
also none of the below attempts worked:
#childrenEntitiesList = Child.get_or_insert(keyslist, parent = u'TEST')
#childrenEntitiesList = Child.get_or_insert(keyslist, parent=self.key().name() )
#childrenEntitiesList = Child.get_or_insert(keyslist, parent=self.key()