다음 사전이 있습니다. 변수 이름은 다음과 같이 내가 템플릿에 전달 division_total_displayDjango 템플릿 사전이 잘못된 순서로 표시됩니다.
{87L: {'name': , 'total': 660L, 'total_percentage': 39, 'total_right': 256L}, 88L: {'name': , 'total': 660L, 'total_percentage': 42, 'total_right': 274L}, 89L: {'name': , 'total': 435L, 'total_percentage': 34, 'total_right': 148L}}
입니다 :
return render_to_response('site/report_topic_standard_stat.html',
{
'report_date' : report_date,
'et_display' : et_display,
'stats_display' : stats_display,
'division_total_display' : division_total_display,
'school' : school,
'board' : board,
'standard' : standard,
'standard' : standard,
'subject' : subject,
'from_time' : from_time,
'term_id' : term_id,
'white_label' : white_label,
},
context_instance=RequestContext(request)
그러나 나는 인쇄 템플릿에 {{division_total_display}}
{88L: {'total_right': 274L, 'total': 660L, 'total_percentage': 42, 'name': }, 89L: {'total_right': 148L, 'total': 435L, 'total_percentage': 34, 'name': }, 87L: {'total_right': 256L, 'total': 660L, 'total_percentage': 39, 'name': }}
순서를 참고 : - 87 대신에 88을 사용합니다.
나는 87 개의 다음부터 시작하고 싶습니다. d에 의해 88 및 89.
위대한 OrderDict가 유용 할 것 같습니다. –