Displaying an HTML table from a Django view in another template

后端 未结 1 1929
别那么骄傲
别那么骄傲 2021-02-06 03:24

So I have a Django view that allows for users to upload a file with data to be graphed via a Pandas dataframe. The graph is then created in a separate view which is referenced w

相关标签:
1条回答
  • 2021-02-06 04:00

    To work over it you can do one of the following listed below:

    1. Use <pre> tag this way all the escaped characters like &lt; &gt; etc will be rendered as it is can be done as:

    <pre> {{ html_table }} </pre>

    1. Use the autoescape filter available in django builtins can be done as:

    {% autoescape off %} {{ html_table }} {% endautoescape %}

    The second option is better as it is given by django and only the developer has the authority over it.

    0 讨论(0)
提交回复
热议问题