python - Include link in html output -
i using following code print error messages
{% if error %} <div class="alert alert-dismissable alert-danger login-fail"> <button type="button" class="close" data-dismiss="alert">×</button> {{ error }} </div> {% endif %}
where error provided template flask code
... return render_template('register.html', error="this test error message.")
i include hyperlink in error message. if do
return render_template('register.html', error="this test error message <a href="http//example.com" </a>.")
it prints string. how can make sure html recognizes html code? carl
normally flask escapes html tags. if want disable replace {{ error }} {{ error | safe}}. prevents autoescaping.
Comments
Post a Comment