In view:
return render_to_response('template.html',
{'headers': list(sort_headers.headers()) },
context_instance=RequestContext(request))
In template:
{{ headers }}
<br />
{{ headers|slice:"1" }}
In browser:
[{'url': '?ot=desc&o=0', 'text': 'Nombre', 'class_attr': ' class="sorted ascending"', 'sortable': True}, {'url': '?ot=asc&o=1', 'text': 'Valor', 'class_attr': '', 'sortable': True}, {'url': '?ot=asc&o=2', 'text': 'Inventario', 'class_attr': '', 'sortable': False}, {'url': '?ot=asc&o=3', 'text': 'Fecha Creacion', 'class_attr': '', 'sortable': True}]
[{'url': '?ot=desc&o=0', 'text': 'Nombre', 'class_attr': ' class="sorted ascending"', 'sortable': True}]
I get a list node with {{ headers|slice:"1" }}
, but now, how to get a dict value? for example 'url' returns '?ot=desc&o=0'
.
Note: Cant use {% for %}
.