I am calling render_template
from a couple of different places, and I'd like to control whether I render certain HTML segments, depending on where I'm calling from.
For example:
render_template('index.html', form=form, show_results=1)
I intended to use the show_results
bool to flag whether the optional segment should be rendered or not. However, I'm missing what wrapper I should have in the optional delimited portion of the HTML code to control whether the segment should be rendered or not. How can I accomplish this?
Use an if block:
{% if show_results %}
show the results
{% endif %}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With