I currently have a working Django application that has a view that outputs a dataframe and is rendered onto a HTML page. Now, I am trying to create a button on this HTML page that allows the user to download the rendered table to their local downloads folder.
How is this done? I am yet to figure it out after doing lots of research trying to get a table from views to HTML to downloaded as CSV.
Python code in views.py
results_html = results.to_html(index=False)
return render(request, 'output.html', {'results_html': results_html})
my current home.html code
<html lang="en-US">
<body>
<table>{{results_html|safe}}</table>
</body>
</html>
I have looked into this and would like more clarification about where to type each thing. I am brand new to Django and still trying to figure out how each file interacts.