[英]Display datraframe into django template
我目前正在Django
上使用stadistics门户,并且尝试使用以下代码在模板中显示数据Dataframe
:
View.py:
def tabla(request):
engine = create_engine('postgresql://postgres:alphabeta@localhost:5432/escaladas')
t='escalado 08/2017'
sqltable = ps.read_sql_table(t,engine)
sqltablehead = sqltable.head(n=10)
table = sqltablehead.to_html(classes='table',index=False,escape=False)
return render(request,'escalamiento.html',{'table':table})
我试过在模板上显示带有for
表,但什么也没显示,并写了{{table}}
但给了我这个https://ibb.co/bVpWw5
有任何想法吗?
请改用{{table|safe}}
,以免HTML 遭到转义 。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.