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 <[email protected]> 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 <[email protected]> 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() --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
