【问题标题】:how can i get the geo_pt on another Model using google app engine(python)如何使用谷歌应用引擎(python)在另一个模型上获取 geo_pt
【发布时间】:2010-09-17 02:03:05
【问题描述】:

这是我的代码:

class Marker_latlng(db.Model):
    geo_pt = db.GeoPtProperty()

class Marker_info(db.Model):
    info = db.StringProperty()
    marker_latlng =db.ReferenceProperty(Marker_latlng)

class BaseRequestHandler(webapp.RequestHandler):
    def render_template(self, filename, template_values={}):
        values={
        }
        template_values.update(values)
        path = os.path.join(os.path.dirname(__file__), 'templates', filename)
        self.response.out.write(template.render(path, template_values))



class HomePage(BaseRequestHandler):
    def get(self):
        q = Marker_latlng.all()
        q.filter("info =", "sss")

        self.render_template('3.1.html',{'datas':q})

3.1.html 是:

var marker_data=[];
{% for i in datas %}
    marker_data.push([{{db.Key(i.marker_latlng).geo_pt}}])
{% endfor %}

但错误是:

TemplateSyntaxError: Could not parse the remainder: (i.marker_latlng).geo_pt

那么,我该怎么办?

谢谢

【问题讨论】:

    标签: javascript python google-app-engine model


    【解决方案1】:

    你的意思是:

    q = Marker_info.all() 
    q.filter("info =", "sss")
    

    ?

    不妨试试这个:

    marker_data.push([{{i.marker_latlng.geo_pt}}]) 
    

    或许:

    marker_data.push([{{i.marker_latlng.geo_pt.lat}}, {{i.marker_latlng.geo_pt.lon}}]) 
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-05-15
      • 2012-08-18
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多