I have a html file I am passing from my views.py
as a context and I can load up a table in my html by simply writing {{loaded_data|safe}}
. However, I want to add a bootstrap class to it so that it is formatted nicely. I've looked through the jinja2 documentation and tried
<table class="table">
{{loaded_data}}
</table>
but none of my attempts worked and I can't seem to find an answer.
Here's a snippet from my views.py
data = pd.read_csv(csv_file)
data_html = data.to_html()
context = {'loaded_data': data_html}
So my question is: How should I go about formatting my table passed as a context from views.py?