ehfeng
ehfeng

Reputation: 3865

Can a class be an Expando and Polymodel in Google App Engine?

If I create a PolyModel class, such as Person, can I create an Expando model under that Polymodel? For instance, a class Male(Person) that was also an Expando model? If so, how?

Thanks!

Upvotes: 0

Views: 557

Answers (1)

Blixt
Blixt

Reputation: 50169

Quote from PolyModel documentation:

PolyModel does not support dynamic properties, like Expando does. There is not an equivalent of PolyModel for Expando.

However, there are ways to work around this by using lower-level datastore APIs. They should work fine even with the PolyModel class. But the code won't be very nice and I don't recommend it. I don't have time to throw together an example now, but maybe I will tomorrow if noone else does it.

For now you could have a look at a PolyModel class I wrote before Google released their own (and yes, the fact that the two have the same name is pure coincidence =), it might inspire you on how to make your own Expando-supporting version, should you come up short of other solutions. Here it is: PolyModel class and PolyModel example.

Upvotes: 4

Related Questions