Saving Objects in GAE with Python

53 views
Skip to first unread message

Saturnino Mateus

unread,
Feb 12, 2015, 6:40:01 AM2/12/15
to google-a...@googlegroups.com
Hello!
Is there any way to save custom objects in datastore instead save basic data types?

Regards!

Saturnino Mateus

unread,
Feb 12, 2015, 8:13:02 AM2/12/15
to google-a...@googlegroups.com
Im not sure, but thinked this:

class Products(ndb.Model):
item = ndb.PickleProperty()

class Item(object):
def __init__(self,name,price,description):
self.name = name
self.price = price
self.description = description

class SomeHandler(webapp2.RequestHandler):
def get(self):
item1 = Item('Coca',5,'some text')
product = Products(item=item1)
product.put()


timh

unread,
Feb 15, 2015, 3:24:54 AM2/15/15
to google-a...@googlegroups.com
Do you mean a custom property ?  As all datastore entities are in fact custom objects.

T
Reply all
Reply to author
Forward
0 new messages