title: Displaying an HTML table from a Django view in another template
body: <p>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 within the original file upload view via an image tag. This works perfectly.</p>
  <p>Now I would also like to display the data in a table format next to the image of the graph. I'm using Panda's built in <code>dataframe.to_html()</code> to create the table in a separate view that will also be referenced within the file upload view.</p>
  <p>I have the table generated correctly and can be seen at the URL specified for the table. I'm running into an error when I try to reference that URL from within my file upload template.</p>
  <p>The error is:</p>
  <p><code>Resource interpreted as Image but transferred with MIME type text/html</code></p>
  <p>I discovered that this is due to the fact that my file upload template has this line:</p>
  <pre><code>&lt;img src=&quot;{% url 'html_graph' %}&quot; /&gt;
  </code></pre>
  <p>since the view is returning an <code>HttpResponse</code> with a <code>content_type</code> of <code>text/html</code>.</p>
  <p><strong>Is there a way to reference that HTML table view from within my file upload template that doesn't use the image tag since the table is HTML rather than an image?</strong></p>
  <h1>Solution</h1>
  <p>Here is my working implementation:</p>
  <pre><code>html_table = df.to_html(index=False)
  return render_to_response('myapp/my_template.html', {'html_table': html_table}, RequestContext(request))
  </code></pre>
  <p>I then reference that <code>html_table</code> in my template like:</p>
  <pre><code>&lt;div&gt;
   {{ html_graph | safe }}
  &lt;/div&gt;
  </code></pre>
  <p><strong>Edit</strong></p>
  <p><em>A correction in the template code:</em></p>
  <pre><code>&lt;div&gt;
   {{ html_table | safe }}
  &lt;/div&gt;
  </code></pre>