I am trying to pass some variables from a child page to a template. This is my python code:
if self.request.url.find("&try") == 1: isTrying = False else: isTrying = True page_values = { "trying": isTrying } page = jinja_environment.get_template("p/index.html") self.response.out.write(page.render(page_values))
Template:
<html> <head> <link type="text/css" rel="stylesheet" href="/css/template.css"></link> <title>{{ title }} | SST QA</title> <script src="/js/jquery.min.js"></script> {% block head %}{% endblock head %} </head> <body> {% if not trying %} <script type="text/javascript"> // Redirects user to maintainence page window.location.href = "construct" </script> {% endif %} {% block content %}{% endblock content %} </body> </html>
and child element:
{% extends "/templates/template.html" %} {% set title = "Welcome" %} {% block head %} {% endblock head %} {% block content %} {% endblock content %}
The problem is that I want to pass the variable "try" to the parent, is there any way to do this?
Thanks in advance!
python html google-app-engine jinja2
ihsoy ih
source share