Oops forgot to type the rest of my response.
If you did what I just outline then it's not quite correct. You should be doing product = Product(PCID=aprodcat) As reference properties expect to be given an object, rather than just a key (that;s why it called .key() method) If you are using a KeyListProperty then you are adding keys to the list directly Rgds Tim On Apr 2, 12:36 pm, Tim Hoffman <[email protected]> wrote: > Do you mean > > aprodcat = ProductCategory() > ... > do some stuff > > aprodcat.put() > > productCat = aprodcat.key() > > product = Product(PCID=productCat) > > Rgds > > Tim > > On Apr 2, 12:07 pm, arnie <[email protected]> wrote: > > > I have two datastore tables ProductCategory and Product > > class ProductCategory(db.Model): > > CategoryName= db.StringProperty() > > CategoryDescription = db.StringProperty() > > > class Product(db.Model): > > PCID = db.ReferenceProperty(ProductCategory,collection_name = > > "PCID") > > Product_Name = db.StringProperty() > > > When I go to create a new instance of Product > > as given below: > > productCat = "a valid ProductCategory Key" > > product = Product(PCID=productCat) > > The above line gives me error saying > > 'str' object has no attribute 'has_key' > > > but if I use > > product = Product(ProductCategory=productCat) > > it makes an entry in the Product table but the foreign key field > > PCID is empty > > What is the problem here? > > 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 [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 -~----------~----~----~----~------~----~------~--~---
