title: How to choose or assign variable in django template?
body: <p>I have an template:</p>
  
  <pre><code>{% if c == 2 %}
      {% for time in a %}
          code(1)
      {% endfor %}
  {% else %}
      {% for time in b %}
          repeat of code(1)
      {% endfor %}
  {% endif %}
  </code></pre>
  
  <p>As you can see this code has an repeating part. I want to refactor like this:</p>
  
  <pre><code>{% if c == 2 %}
      var = a
  {% else %}
      var = b
  {% endif %}
  {% for time in var %}
      code(1)
  {% endfor %}
  </code></pre>
  
  <p>How to do this?</p>