【发布时间】:2011-04-06 20:09:33
【问题描述】:
if(len(f1) > 0):
for qs in profile_map:
p = Profile.objects.get(pk=qs.emp.id)
t_name = p.first_name + p.last_name
t_arr.append((q.profile.id,emp_name))
response_dictionary.update({'tarr':t_arr})
render_to_response('project/profile_table.html',context_instance=RequestContext(request,{'response_dictionary': response_dictionary}))
在 Django 模板中如何解码 1. 元组的所有值 2. 在元组中搜索 q.profile.id 中的某个值
{% for ele in response_dictionary.tarr%}
alert('{{ele}}');
//Get this as alert (11L, u'Employee3.')
{% endfor %}
【问题讨论】:
标签: python django django-views django-templates