FLASK - Changeable in template

Asked

Viewed 436 times

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 answer

2


To change/assign variables within the template is used:

{% set variavel = valor %}

Ex:

{% set active_page = "index" %}

References:

  • 1

    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!!

Browser other questions tagged

You are not signed in. Login or sign up in order to post.