views:

92

answers:

1
  if(len(f1) > 0):  
    for qs in profile_map:
        up = Profile.objects.get(pk=qs.emp.id)
        t_name = up.first_name + up.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}))

In Django template How to deocode all the 1.values of the tuple 2.search the tuple for a certain value in q.profile.id

        {% for ele in response_dictionary.tarr%}
            alert('{{ele}}');
        //Get this as alert (11L, u'Employee3.')
         {% endfor %}  
+1  A: 

In your case, the generator will assign the tuple to ele, so you can access the first, last name with {{ ele[0] }} {{ ele[1] }}.

But this is also legal, to unpack the tuple into two vars:

{% for first_name, last_name in response_dictionary.tarr %}
kRON
@kron:I got an error for {{ ele[1] }} but second statemnet works fine..
Hulk