views:

213

answers:

2

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!

+3  A: 

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.

Blixt
Wow thanks! I probably will end up working around it, but I still really appreciate the examples.
ehfeng
A: 

Hi, have anyone managed to create own PolyExpando class by mixing both GAE classes features in some way?