Displaying an HTML table from a Django view in another template

后端 未结 1 1944
别那么骄傲
别那么骄傲 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
       tag this way all the escaped characters like < > etc will be rendered as it is can be done as:

      {{ html_table }}
    

    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)
提交回复
热议问题