In your module definition you should use a property class, that is instead of:
class Tag(db.Model): transaction = db.Key(encoded=None) ... you should use: class Tag(db.Model): transaction = db.StringProperty(required=True) ... ...if you want to store the string representation of the key. Or: class Tag(db.Model): transaction = db.ReferenceProperty(Transaction, required=True) ... ...if you want to store the key itself. In the former case you should use this code: tag = Tag(transaction=str(transaction.key()), ...) tag.put() # tag.transaction is a string, need to construct the key from it tr_key = db.Key(tag.transaction) transaction = Transaction.get(tr_key) And in the latter case: tag = Tag(transaction=transaction, ...) tag.put() # tag.transaction is automatically de-referenced transaction = tag.transaction Hope this helps. Alex -- www.muspy.com On Dec 23, 9:09 am, Shay Ben Dov <shay.ben...@gmail.com> wrote: > Hi this is the issue > > I have a Transaction model > > I do: > transaction=Transaction(....) > transaction.put() > > tr_key = str(transaction.key()) > > I want to store it in a second mode > > class Tag(db.Model): > > transaction = db.Key(encoded=None) > tag = db.StringProperty(required=True) > user = db.UserProperty(required=True) > > I do: > > tag = Tag(transaction=tr_key,....) > tag.put() > > later on in the application I retrieve the tag entity and I want to > get the transaction back > > I do: > tr_key = tag.transaction > transaction = Transaction.get(tr_key) > > and I get an error message: > BadKeyError: Key datastore_types.Key.from_path(_app=u'') is not > complete. > > Every help or example is very appreciated. > > Thanks, > > Shay --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---