0

Is there anyway I can pass my html page a string variable and have it read it a code for a table? Contents of string:

<tr> <td> temp/file.docx</td> <td> Safe</td> <td> 2018-06-18 14:58:14</td> 
</tr><tr> <td> temp/doc.c</td> <td> Safe</td> <td> 2018-06-18 14:58:30</td> 
</tr><tr> <td> temp/someCprogram.c</td> <td> Queued</td> <td> 2018-06-18 15:00:16</td> </tr> 

I've tried passing the variable like so:

 return render_template('analysis.html', table_=complete_table, version=__version__, escapse=False)

The html code for the table looks like this:

<table border="1" class="dataframe">
  <thead>
    <tr style="text-align: right;">
      <th></th>
      <th>Path</th>
      <th>Status</th>
      <th>Time</th>
    </tr>
  </thead>
  <tbody>
     {{table_}}
  </tbody>
</table>

I'm fairly new to html so any help is appreciated. (p.s. I'm also using flask app and python for the back-end)

Edsel Norwood
  • 149
  • 1
  • 2
  • 11

1 Answers1

2

You need to use safe, so the templating engine knows to render the data passed as html:

<tbody>
 {{table_|safe}}
</tbody>
Ajax1234
  • 69,937
  • 8
  • 61
  • 102