Hello everyone,

I just can't solve a problem. I have an array of dictionaries each having
random fields, and those fields are referenced in another variable, like
this:

something = {
    "headers": [{"name": "first", "value": "From"}, {"name": "two", "value":
"To"}],
    "content": [{"first": "Alaska", "second": "Nebraska"}, {"first": "Iowa",
"second": "Texas"}]
}

So I need to iterate through something["headers"] (for item.name as name in
something["headers"]) and put relevant content like this:
something["content"][name].

The problem is that dictionary is sent to template, and I don't know how to
"select" an item from content where content[i].name is equal to the header's
name in iteration.

I tried this:

{% for header in something.headers %}
    {% for element in something.content %}
        element.header
    {% endfor %}
{% endfor %}

It tries to take element["header"], and it is not correct. How do I solve
this problem?

-- 
Best regards,
Rishat Muhametshin, technical writer
Co BIT “Master”, Izhevsk, Russia
http://friendfeed.com/rishatmuhametshin

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to