I pass dict
addon_id_value_mapping =
{'menu': '1', 'opening_hour': '2', 'books': '3', 'doctors': '4'}
and
addon_list = [{u'menu': [{u'price': 50, u'name': u'Momo', u'price_level': u'cheap'},
{u'price': 510, u'name': u'potato', u'price_level': u'expensive'},
{u'price': 100, u'name': u'Chowmein', u'price_level': u'expensive'}]},
{u'opening_hour': [{u'close': 17, u'open': 9, u'day': 0},
{u'close': 17, u'open': 9, u'day': 1},
{u'close': 16, u'open': 8, u'day': 2}]}]
from view to django-template. I can access the value of the dict using template-tags to display but I couldn't able to pass in url field. What should I need to do to pass variable value that store in dict in url parameter
{% if addon_list %}
{% for addon_name in addon_list %}
{% for key, values in addon_name.iteritems %}
<table>
<tr>
<td>
<h2>{{ key }}</h2>{# title- menu #}
</td>
<td>
<h5><a href="{% url 'addon:update_addon' spot_id addon_id %}">
update</a></h5>
</td>
{#todo <I need value of key variable above to replace addon_id. for key== menu I need 1 value>#}
</tr>
<tr>
</tr>
{% for value in values %}
{% for k,v in value.iteritems %}
<tr>
<td>{{ k }}</td>
<td>{{ v }}</td>
</tr>
{% endfor %}
{% endfor %}
{% endfor %}
{% endfor %}
</table>
{% endif %}
I'm using Django 1.6.5