I'm looking for the best way of storing list of entities of different Kinds that have a common parent. I came up with the following:
class Action(ndb.Model):
date = ndb.DateTimeProperty(auto_now_add = True)
class ContentAction(Action):
content = ndb.StringProperty()
class AuthoredAction(Action):
author = ndb.StringProperty()
class ActionContainer(ndb.Model):
actions = ndb.StructuredProperty(Action, repeated=True, indexed=False)
Unfortunately once I add 2 entities of different types to the action list, there is no way to tell of which type the entity is (they all are Actions).
Also it appears that inherited properties of an entity that is of a different class than the entity that was added as a first one are lost. For instance, after adding a ContentAction and then AuthoredAction, the latter object is an Action with no 'author' property. Perhaps StructuredProperty allows only for storing objects of the same kind? Is there a better way of structuring this?