我render_template
要从几个不同的地方打电话,我想根据我从哪里打电话来控制是否渲染某些HTML段。
例如:
render_template('index.html', form=form, show_results=1)
我打算使用show_results
布尔值来标记是否应该呈现可选段。但是,我缺少了在HTML代码的可选定界部分中应具有的包装程序来控制是否应呈现该段。我该怎么做?
使用if块:
{% if show_results %}
show the results
{% endif %}
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句