Passing HTML to template using Flask/Jinja2

后端 未结 5 1510
灰色年华
灰色年华 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 08:02

    From the jinja docs section HTML Escaping:

    When automatic escaping is enabled everything is escaped by default except for values explicitly marked as safe. Those can either be marked by the application or in the template by using the |safe filter.

    Example:

     
    {{data.email_content|safe}}

提交回复
热议问题