1
I passed to the template a variable and need to change (in the template) the value of it.
Ex.: in the controller: return render_template('index.html', start_code = start_code)
. I need to change start_code
in the template. How do I?
1
I passed to the template a variable and need to change (in the template) the value of it.
Ex.: in the controller: return render_template('index.html', start_code = start_code)
. I need to change start_code
in the template. How do I?
2
To change/assign variables within the template is used:
{% set variavel = valor %}
Ex:
{% set active_page = "index" %}
References:
Browser other questions tagged python template flask jinja2
You are not signed in. Login or sign up in order to post.
Thank you so much @Tuxpilgrim, it worked! I had read the documentation on the link http://jinja.pocoo.org/docs/2.10/templates/#variables, I got some comments on the command {% set %}, but I didn’t get the expected result. Big hug!!
– Alexandro Santos