Initially the user is presented with a form which he inputs some values and clicks Submit. Once Submit is clicked the class One is called which renders a jinja2 template with the results.
class One(webapp2.RequestHandler):
def post(self):
# It gets the user's input from
# an HTML form
area = self.request.get('area')
# It then passes area in a
# different class (CalculateArea)
# for some calculations
calculations = CalculateArea()
results = calculations.distance(area)
values = {
'results': results
}
template = JINJA_ENVIRONMENT.get_template('results.html')
self.response.write(template.render(values))
On the rendered page there is a new button which when clicked calls class Two.
class Two():
def get(self):
# Here I want to use area and results from class One
distance = area
new = results
What I'm trying to do is to use variables area and results in Class Two.