2010-09-17 3 views
0

ceci est mon code:comment puis-je obtenir le geo_pt sur un autre modèle en utilisant Google App Engine (python)

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}) 

et 3.1.html est:

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

mais l'erreur est la suivante:

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

alors, que puis-je faire?

grâce

Répondre

0

Vouliez-vous dire:

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

?

Peut-être essayer ceci:

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

Ou peut-être:

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