Hi guys I have a pretty basic question in a template of Django
In my view.py
file I have this
select_list = [{'v':'By Visit'}, {'p':'by Patient'}]
select_item = {}
select_item['select_opc'] = select_list
final_value.append(select_item)
print final_value
context['new_object_list'] = final_value
return context
So in my view I have this
{% for item in new_object_list %}
{% for lista in item.select_opc %}
{{ lista }}
{% endfor %}
{% endfor %}
lista
return this
{'v': 'By Visit'} {'p': 'by Patient'}
a dictionary I want to create a select with this but I only obtain de key, no the value
I try this
{% for item in new_object_list %}
{% for lista in item.select_opc %}
{% for k, v in lista %}
{{ k }}
{{ v }} or {{ lista.k }}
{% endfor %}
{% endfor %}
{% endfor %}
I try this too {% for k, v in lista.iteritems %}
but nothing work, but if I try in the terminal works!!
Any idea