Passing HTML to template using Flask/Jinja2

后端 未结 5 1414
灰色年华
灰色年华 2020-11-21 07:44

I\'m building an admin for Flask and SQLAlchemy, and I want to pass the HTML for the different inputs to my view using render_template. The templating framework

5条回答
  •  粉色の甜心
    2020-11-21 07:56

    You can also declare it HTML safe from the code:

    from flask import Markup
    value = Markup('The HTML String')
    

    Then pass that value to the templates and they don't have to |safe it.

提交回复
热议问题