python - How to print query output in Html using google app engine -



python - How to print query output in Html using google app engine -

entity kind :football entity key :ag9kzxz-ywnxdwl0d29ybgryfqsscezvb3riywxsgicagica8iskda id : 5681726336532480 email (string) manutd@gmail.com identity (string) manchester united

this info in datastore. want search details based on input(emailid). so, if input email detail, want fetch corresponding club name , print on html page. have written next code

class searchapp(webapp2.requesthandler): def get(self): #self.response.out.write(que) name=self.request.get('last_name') player_key=football.query() #qry=football.key(5891733057437696) qry=player_key.filter(football.email==name) #for qry2 in qry: self.response.out.write('<b>%s</b> wrote:' % qry.identity())

from understood, qry object, need utilize loop , print result in qry2.email, qry2.identity. reason, not able hence commented part. need know how fetch details.

i got next error :

self.response.out.write('<b>%s</b> wrote:' % qry.identity())

attributeerror: 'query' object has no attribute 'identity' how can possible model function has email , identity.

if identify field on model not need called () it's not function.

this wrong:

identity = qry.identity()

this right:

identity = qry.identity

but won't work because have query object, not model. take @ documentation

https://cloud.google.com/appengine/docs/python/datastore/queryclass

q = db.query(song) song in q: print song.title

not song.title not expressed song.title()

you can write response 1 time need like:

q = db.query(song) info = [] song in q: data.append(song.title) self.response.out.write(','.join(data))

that'll stick list of titles single string separated commas.

take @ documentation. problem practically same example.

python google-app-engine

Comments

Popular posts from this blog

java - How to set log4j.defaultInitOverride property to false in jboss server 6 -

c - GStreamer 1.0 1.4.5 RTSP Example Server sends 503 Service unavailable -

Using ajax with sonata admin list view pagination -