Pass pandas framework to Django template

I am building a website using Django, bootstrap3 and Dajaxice. I want to pass a pandas dataframe from my views.py to one of my templates, but I'm having trouble getting it working. I need this as a dataframe, not html, so using is .to_html()

not an option.

html :

<div class="text-center">
    <button class="btn btn-primary" type="button" name="UpdateDB" onclick="submitverify({{file_dfs}})">Submit Files {% bootstrap_icon "chevron-right" %}</button> 
</div>

      

When I try to walk through file_dfs

, I get an error Uncaught SyntaxError: Unexpected token ILLEGAL

on {{file_dfs}}

. When I open the chrome development tool, it looks like this:

<button class="btn btn-primary" type="button" name="UpdateDB" onclick="submitverify({&#39;_COMM_&#39;: [], &#39;_CMD_&#39;: [         WINDOW_START ...]})"

      

Can anyone help me on this?

Thank!

+3


source to share


1 answer


Is auto shielding enabled? It looks like Django has it enabled by default (see code.djangoproject.com/wiki/AutoEscaping ). If it is enabled, you need to disable it for the data frame.



+1


source







All Articles