I don't understand why you are modeling it that way.  Why have the
ReferenceProperty in Location?

Given your case of wanting all people with a given birthplace, it
seems like this makes sense:

class Person(db.Model):
    name = db.StringProperty()
    birthplace = db.ReferenceProperty(Location, default="unknown",
collection_name='born_here')

class Location(db.Model):
    place = db.StringProperty()

Since a person is likely only born in one place, you put the reference
with the Person.
Now you can do:
  birthplace = my_person.birthplace    # gets Location
and
  some_location.born_here   # list of Person born here


On Feb 9, 9:27 pm, adelevie <[email protected]> wrote:
> I know the datastore is not relational but this should still be
> simple.
>
> I have two models:
>
> class Person(db.Model):
>      name = db.StringProperty()
>
> class Location(db.Model):
>      birthplace = db.StringProperty()
>      name = db.ReferenceProperty()
>
> So I want to be able to select all People given a birthplace. I tried
> messing with keys, but to no avail.
>
> thanks,
> Alan
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to