title: django - Use loop variables as a dictionary key
body: <p>I have some issues with access of a specific key in my template. Here is my code :  </p>
  
  <pre><code>{% for rsim,couples in zipped_formated_rxnsim_pairedsim %}
      -{{rsim.xxx_fk.xxx_code_char}} #ex : toto
      {% for rsim2,couples2 in mydict.{{rsim.xxx_fk.xxx_code_char}}%}
          &lt;li&gt; {{rsim2}} - {{couples2}}&lt;/li&gt;
      {% endfor %}
  {% endfor %}
  </code></pre>
  
  <p>It gives me this error, </p>
  
  <blockquote>
    <p>Could not parse the remainder: '{{rsim.xxx_fk.xxx_code_char}}' from 'mydict.{{rsim.xxx_fk.xxx_code_char}}'</p>
  </blockquote>
  
  <p>I do not understand this behaviour, because if I hard code the line <code>{% for rsim2,couples2 in mydict.{{rsim.pdb_fk.pdb_code_char}}%}</code> to <code>{% for rsim2,couples2 in mydict.toto %}</code> it works ... I mean, how can I do something about this idea ?</p>
  
  <p>I really need this loop structure, because I want to go through "<em>rsim2,couples2</em>" tuples only for a specific "<em>rsim,couple</em>" tuple. In others words, "<em>rsim2,couples2</em>", are extra data linked with  "<em>rsim,couples</em>". What a better solution than a dictionary using a key ?</p>
  
  <p>I tried using the {{with}} tag, adding a variable to use directly as a key, but it did not work. Any help would be appreciated.</p>
  
  <p>Thank you !</p>