{% macro msg_error(name) %}
{% for error in form.{{ name }}.errors %}
<H5>{{ error }}</H5>
{% endfor %}
{% endmacro %}
I used macros in the jinja2 template syntax, but an error was reported. The problem is that the name is quoted incorrectly. How should the name be quoted correctly?
迷茫2017-06-12 09:27:17
For example
@app.route('/error')
def func_error(func_name):
return render_template('error.html',name=func_name)
name is the variable name in your template