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
-~----------~----~----~----~------~----~------~--~---

Reply via email to