title: Dynamic fields depending of previous fields with WTForms
body: <p>I am making a form using WTForms. For the moment, I have this:</p>
  
  <pre><code>class UploadForm(flask_wtf.Form):
      fichier = wtforms.fields.FileField(u'Fichier')
      description = wtforms.fields.TextAreaField(u'Description')
      year = wtforms.fields.SelectField(u'Année', choices=[('1A','1A'),('2A','2A')])
      subject = wtforms.fields.SelectField(u'Matière', choices=app.config['SUBJECTS'])
      submit = wtforms.fields.SubmitField(u'Envoyer')
  </code></pre>
  
  <p>With <code>SUBJECTS = [('Sub1','Sub1'), ('Sub2','Sub2')]</code> and this template:</p>
  
  <pre><code>{% block content %}
    &lt;h2&gt;Form&lt;/h2&gt;
    &lt;form action="{{ url_for('get') }}" method="post"
            enctype="multipart/form-data"&gt;
      {{ form.hidden_tag() }}
  
      {{ form.fichier.label }}
      {{ form.fichier }}
  
      {{ form.description.label }}
      {{ form.description }}
  
      {{ form.year.label }}
      {{ form.year }}
  
      {{ form.subject.label }}
      {{ form.subject }}
  
      {{ form.submit }}
    &lt;/form&gt;
  {% endblock %} 
  </code></pre>
  
  <p>But the subjects are not the same for all the years, so I’d like to make the list for the subject field dynamic, in order to propose only the subjects corresponding with the selected year. Any idea how I can do that ?</p>