title: how to iterate over this attributes in jinja2 template?
body: <p>In view method, i do this:</p>
  
  <pre><code> for i in range(0,15):
         setattr(object, 'f%d' % i, 'abc')
  </code></pre>
  
  <p>So now i have attributes f1, f2,f3,f4,f5.
  Then how can i iterate over it in jinja2 template?</p>
  
  <p>Something like this, or i dont know:</p>
  
  <pre><code> {%for i in range(0,15)%}
     {{f}}i
  {%endfor%}
  </code></pre>
  
  <p><b>EDIT:</b>
  in view method, form['select%d'|format(i)] doesnt work, but in template it does</p>
  
  <pre><code>def method():       
  class F(Form):
      pass
  count=0
  
  for attempt in e.attempts_of_exam:
      setattr(F, 'select%d'%count, SelectField(attempt.attempter.username,
                                      validators=[validators.optional()],
                                      choices=[('A', 'A'), ('B', 'B'), ('C', 'C'),
                                       ('D', 'D'), ('E', 'E'), ('FX', 'FX'),
                                       ('n/a', 'n/a')]))
      count +=1
  
  form = F()
  i =0
  if form.validate_on_submit():
      for attempt in e.attempts_of_exam:
          attempt.result = form['select%d'|format(i)].data
          i +=1
      db.session.commit()
      return redirect(url_for('attempts_of_exam',id=e.id))
  
  
  else:
      return render_template('update_exam_results.html',
          form=form,
          count=count,
          exam = e)
  </code></pre>
  
  <p>and then in template</p>
  
  <pre><code>{{ form.hidden_tag() }}
      &lt;table border='1'&gt;
              {% for i in range(count) %}
              &lt;tr&gt;
                  &lt;td&gt; 
                      {{ form['select%d'|format(i)].label}}
                  &lt;/td&gt;
                  &lt;td&gt;
                      {{ form['select%d'|format(i)]}}
                  &lt;/td&gt;
              &lt;/tr&gt;
              {% endfor %}
      &lt;/table&gt; 
  </code></pre>