title: Flask-WTForms - Simple CRUD Example - Value Not Populating Form
body: <p>I've read every tutorial and bit of documentation I can find, but can't find my problem. I have made this as simple as possible, using "companies" as an example. When I load my /company/edit/2 url, the form doesn't populate the value.</p>
  
  <h1>view</h1>
  
  <pre><code>@app.route('/company/edit/&lt;id&gt;')
  def company_edit(id):
    company = {'id': 2, 'company_name': 'SomeCo'} #dummy object
    form = CompanyForm(obj=company)
    #form = CompanyForm(None, company) #tried this too, based on API
    return render_template('company_form.html', form = form)
  </code></pre>
  
  <h1>form object</h1>
  
  <pre><code>class CompanyForm(Form):
    company_name = TextField('company_name', validators = [Required()])
  </code></pre>
  
  <h1>form template</h1>
  
  <pre><code>&lt;!-- extend base layout --&gt;
  {% extends "base.html" %}
  
  {% block content %}
  
  &lt;form action="" method="post" name="login"&gt;
      {{form.hidden_tag()}}
      &lt;p&gt;
          Company Name:&lt;br&gt;
          {{form.company_name(size=80)}}&lt;br&gt;
      &lt;/p&gt;
      &lt;p&gt;&lt;input type="submit" value="Sign In"&gt;&lt;/p&gt;
  &lt;/form&gt;
  
  {% endblock %}
  </code></pre>
  
  <p>my understanding is that this should work - the route /company/edit/x would call company_edit(x), which declares the dummy company object (later to be pulled from a db), instantiates a form, passing the company object, then renders the template passing the form. The form template should be able to match the field names in the company object, to corresponding input names in the form object, and populate the text field with the value "SomeCo". Am I missing something obvious?</p>
  
  <p>Thanks!</p>