Skip to content Skip to sidebar Skip to footer

Displaying An Html Table From A Django View In Another Template

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 with

Solution 1:

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.

Post a Comment for "Displaying An Html Table From A Django View In Another Template"