you can achieve this in polymodel by adding all common properties to
polymodel base class and specific property to the hierarchy.

i.e.

Class LivingThing(polymodel.PolyModel):
    Kingdom = db.StringProperty()
    Phylum = db.StringProperty()
    Subphylum = db.StringProperty()

Class Mammal(LivingThing):
    noofbreast = db.IntegerProperty()

class Monkey(Mammal):
   canjump = db.BooleanProperty()

now you can create class monkey as,
Monkey(Kingdom="Animal",canjump=True)

and later query as LivingThing.filter("Kingdom =","Animal").fetch()

can return Monkey.

On Jul 19, 1:04 pm, Bill Edwards <twmaf...@gmail.com> wrote:
> Hi!
>
> I've been recently trying to wrap my head around GAE's datatypes.  Is
> there a model type in GAE that allows me to define subproperties?  For
> example, I want to have a "category" property where some categories
> fall under others, and when i query for all entities within a
> supercategory, i get the subcategories also.
>
> For example:
> class Animals(db.Model):
>     type = db.StringProperty()
>
> Animals(type='mammal')
> Animals(type='chimpanzee')
> Animals(type='monkey')
>
> When I query for all animals with type mammal, i want to return all 3
> of the above objects.
>
> I've read through the documentation, and the PolyModel datastore model
> has struck my eye as being potentially helpful.  However, it doesn't
> seem to quite do the job.
>
> Thanks!

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To post to this group, send email to google-appeng...@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en.

Reply via email to