如何设置geotproperty?谷歌应用引擎

2024-06-01 13:28:52 发布

您现在位置:Python中文网/ 问答频道 /正文

我有这个型号:

class location(ndb.Model):
      geoLocation = ndb.GeoPtProperty()

我使用此函数声明位置模型:

^{pr2}$

但是我得到了一个错误:NoneType'object没有属性'lat'

怎么了?在


Tags: 函数模型声明model属性object错误location
1条回答
网友
1楼 · 发布于 2024-06-01 13:28:52

来自NDB Document

You can construct one with two floats like ndb.GeoPt(52.37, 4.88) or with a string ndb.GeoPt("52.37, 4.88"). (This is actually the same class as db.GeoPt)

所以任务是

location1.geoLocation = ndb.GeoPt(lat,lon)

相关问题 更多 >