0

From views.py I have:

def do_something(request, context, template="index.html"):
   ....
   type = ['A', 'B', 'C']
   map = {'A': 'a', 'B': 'b', 'C': 'c'}
   context['type'] = type
   context['map'] = map
   return (request, template, context)

And in the template I would like to access to play with value in map like this:

</html>
....
{% for t in type %}
    {% with m = map[t] %}
    {% endwith %}
    // do sth
{% endfor %}

But I got TemplateSyntaxError: Could not parse the remainder: '[t]' from 'map[t]' Anyone please help me, thanks so much.

dientmUET
  • 101
  • 1
  • 1
  • 14

0 Answers0