I’m a flask newbye and I was wondering how to render dynamically a template in a model by pressing a button in another one. Something like
<button href = /view >
and I want to be rendered this code
`{% this_has_to_be_true %}
{% endif %}`
Is there any function that allows me to do that? Note that I don’t want to be displayed the code
while I make a normal GET request to the view /view.
Thanks in advance.
I tried to use the flask url_for
function and tried to pass a parameter inside it but it doesn’t work. Something like:
@app.route('/view/<param>') def fun(param): if param: render_template('template.html',this_has_to_be_true=param) else: render_template('template.html')
I received an error such as in here and it also doesn’t fit with my routes since it modify how my subdomain would be built (something like /view/like wouldn’t work properly I think).
I also tried using another route /view-supp and using jquery and creating another route /view-supp but then, again, I donno how to redirect.
giocanedoli is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.