title: Save a form in flask ?
body: <p>i have code for form , i want to save the data through a form.
  custom form is :-</p>
  
  <pre><code>&lt;form class="well span12 c1" name="contacts" method="POST"&gt;
  &lt;label&gt;First Name&lt;/label&gt;
              &lt;input type="text" placeholder="Your First Name" class="span12" required  name="firstname" &gt;
              &lt;label&gt;Last Name&lt;/label&gt;
              &lt;input type="text" placeholder="Your Last Name" class="span12" required   name="lastname" &gt;
              &lt;label&gt;Email Address&lt;/label&gt;
              &lt;input type="text" placeholder="Your email address" class="span12" required  name="email" &gt;
              &lt;label&gt;Subject&lt;/label&gt;
              &lt;select class="span12" name="subject" id="subject" required &gt;
                  &lt;option value="na" selected=""&gt;Choose One:&lt;/option&gt;
                  &lt;option value="service"&gt;General Customer Service&lt;/option&gt;
                  &lt;option value="suggestions"&gt;Suggestions&lt;/option&gt;
                  &lt;option value="product"&gt;Product Support&lt;/option&gt;
              &lt;/select&gt;
  
  
              &lt;label&gt;Message&lt;/label&gt;
              &lt;textarea rows="8" class="input-xlarge span12" id="message" name="message" required &gt;&lt;/textarea&gt;
  
          &lt;button class="btn btn-primary pull-right" style="border-radius:0px;" type="submit"&gt;Send&lt;/button&gt;
  
  &lt;/form&gt;
  </code></pre>
  
  <p>views.py :-</p>
  
  <pre><code> @app.route('/contact' ,  methods = ['GET' , 'POST' ])
  def contact():
      if request.method == 'POST':
          user = user_email(firstname = request.form['firstname'] , 
              lastname = request.form['lastname'],
              email = request.form['email'],
              subject = request.form['subject'],
              message = request.form['message'])
          user.save()
          return render_template('index.html')
      else:
          return render_template('contact.html')
  </code></pre>
  
  <p>there is an error of AttributeError: 'Database' object has no attribute 'model'. Please help me to solve this problem.</p>