Django将Dict值呈现到模板需要更多的时间

2024-10-02 02:26:47 发布

您现在位置:Python中文网/ 问答频道 /正文

我有大约50个键值对的字典。在

我试着把这个渲染成我的模板。在

** Some Operations here **
temp={...........}  // It has 50 pairs
return render_to_response(
    'tr/page.html',
    tempContentRes,
    context_instance=RequestContext(request)
)

在模板文件tr中/页面.html我使用dict值到一些文本框和一些图表。在

例如

^{pr2}$

我已经在视图页面设置了时间差视图中的所有操作不到一秒。在

问题是,呈现html大约需要2分钟。在

我的dict中的示例内容:

temp = {
    'price_range': ['[4,0],[3,0],[2,0],[1,10],[0,0]', '[4,0],[3,2],[2,0],[1,0],[0,0]', '[4,0],[3,0],[2,0],[1,1],[0,0]'],
    'List': u'<li><a href="/dashboard/performance/?store=Play_list">Play_list</a></li><li><a href="/drd/page/?sre=Road">Road</a></li><li><a href="/drd/page/?sre=Sify">Sify</a></li><li><a href="/drd/page/?sre=Youtube">Youtube</a></li>',
    'PlaysCount': 14L,
    'trc': [u'12345678', u'123456789', u'1234567'],
    'tbCount': 15L,
    'rdePer': 0,
    'rylist': {'ca': 1, 'gb': 11, 'se': 2},
    'topCount': 57L,
    # .......
}

Tags: 视图模板playhtmlpagelitemptr

热门问题