开发者

GAE Query fetch()

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜