My dictionary looks some think like this.
allCurrencies = {
'AUD': ['Australian Dollar', 'au'],
'GBP': ['British Pound', 'gb'],
'CAD': ['Canadian Dollar', 'ca'],
'INR': ['Indian Rupee', 'in'],
'JPY': ['Japanese Yen', 'jp'],
'RUB': ['Russian Ruble', 'ru'],
'SGD': ['Singapore Dollar', 'sg'],
'CHF': ['Swiss Franc', 'ch'],
'USD': ['US Dollar', 'us']
}
and my array contains this:
commonCurrencies = ['USD', 'EUR', 'GBP', 'JPY']
My main goal is to iterate commonCurrencies and use it as a key for the dictionary allCurrencies.
My django template currently look like this:
<tr>
{% for sym in commonCurrencies %}
<td>{{allCurrencies.sym.0}}<td>
{% endfor %}
</tr>
But it does not seem to work. What am I doing wrong. Thanks