开发者

GAE Query fetch()

开发者 https://www.devze.com 2023-01-20 07:17 出处:网络
I am trying to learn simple operations with the datastore and I am having problems. Can someone help why this is not working?

I am trying to learn simple operations with the datastore and I am having problems. Can someone help why this is not working?

class Pet(db.Model):
    name = db.StringProperty

pet = Pet(name="Fl开发者_JAVA百科uffy")

pet.put()

query = Pet.all()

results = query.fetch(limit=5)
print pet.name

When I run this I get

<class 'google.appengine.ext.db.StringProperty'>


Try changing

name = db.StringProperty

to

name = db.StringProperty()
0

精彩评论

暂无评论...
验证码 换一张
取 消