> > > message = Message(handle=handle,owner=person.key())
That line always creates a new Message instance. Why do you think that it should do anything else? (The only way to get copies of existing instances is with get() and queries.) On May 29, 8:05 pm, thebrianschott <schott.br...@gmail.com> wrote: > Woobie, > > I don't understand the difference between using a key, like I think > my example shows I am doing, and a key_name. Can you > direct me further, please? > > On May 29, 10:46 pm, Wooble <geoffsp...@gmail.com> wrote: > > > > > No, of course not. You can have multiple Message entities that all > > have the same owner. If you want to update an existing entity, get > > it, modify it, and put it again, or use a key_name. > > > On May 29, 9:20 pm, thebrianschott <schott.br...@gmail.com> wrote: > > > > When I use the code below, a new message with the same Person > > > ReferenceProperty (and same "handle") results in a new db instance, > > > rather than updating the existing entity as I think it should > > > according to > > > the following link. Isn't it supposed to just update the existing > > > instance, > > > without creating another? > > > >http://code.google.com/appengine/docs/python/datastore/creatinggettin... > > > > Thanks, > > > > Brian in Atlanta > > > > *******************code excerpt below > > > > class Person(db.Model): > > > user = db.UserProperty() > > > address = db.EmailProperty() > > > skillName = db.StringProperty() > > > > class Message(db.Model): > > > owner = db.ReferenceProperty(Person) > > > comment = db.TextProperty() > > > handle = db.StringProperty() > > > > class SendMessage(webapp.RequestHandler): > > > def post(self): > > > skillName_id = self.request.get('skillName') > > > handle = self.request.get('handle') > > > comment = self.request.get('comment') > > > key = db.Key.from_path("Person", skillName_id) > > > person = Person.get(key) > > > message = Message(handle=handle,owner=person.key()) > > > message.comment = comment > > > message.handle = handle > > > message.put()- Hide quoted text - > > - Show quoted text - --~--~---------~--~----~------------~-------~--~----~ 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-appengine@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 -~----------~----~----~----~------~----~------~--~---