Hi,
I had read the docs for Appengine to know how to retrieve data from Models. But i´m missing something..
My models are user and student, where student is a reference property from user.
Users login, fill form with some values and save the data with put(). If you login with [email protected] you get your data or if you login with another email you get the data corresponding to your information sent to db.
Everythin is fine till here. I´m trying to get a PDF and want to get the data from the user loged in.
Example:
class SavePDF(webapp.RequestHandler):
def post(self):
user = users.get_current_user()
if user:
student= models.Student.all().get()
p = canvas.Canvas(self.response.out)
p.drawImage('ipca.jpg', 40, 700)
p.drawString(50,640, 'Student Info:' + '%s' % student.name)
p.drawString(50,620, 'Adress:' + '%s' % student.adress)
p.drawString(50,300, 'PDF updated:%s' % str(datetime.date.today()))
p.showPage()
self.response.headers['Content-Type'] = 'application/pdf'
self.response.headers['Content-Disposition'] = 'filename=mypdf.pdf'
p.save()
What i get here is a user that is not current user. Shows Info about other user. I´ve tried different things but it throws errors. If i try to iterate gives error.
I´m missing something.