Пожалуйста, объясните мне, почему это происходит?Какова роль {{field | safe}}?
Мой код App.py -
class ContactForm(FlaskForm):
name = StringField("Name Of Student",validators = [InputRequired(message
= 'Name is missing'),Length(min=5,max=10,message="wrong")])
email = StringField("email",[validators.Email("Please enter your email
address.")])
@app.route('/form', methods = ['GET','POST'])
def index():
form = ContactForm()
if form.validate_on_submit():
return render_template('macro_output.html',form=form)
return render_template('main_form.html',form=form)
macro_form.html
{% macro render_output(field) %}
<p>
{{ field.label}}
{{ field |safe}}
</p>
{% endmacro %}
macro_output.html
{% from "macro_form.html" import render_field,
render_ErrorMessage,render_output %}
<html>
<body>
{{ render_output(form.name)}}
{{ render_output(form.name.data)}}
{{ render_output(form.email)}}
{{ render_output(form.email.data)}}
</body>
</html>