form のコードがあり、フォームを介してデータを保存したい。カスタムフォームは:-
<form class="well span12 c1" name="contacts" method="POST">
<label>First Name</label>
<input type="text" placeholder="Your First Name" class="span12" required name="firstname" >
<label>Last Name</label>
<input type="text" placeholder="Your Last Name" class="span12" required name="lastname" >
<label>Email Address</label>
<input type="text" placeholder="Your email address" class="span12" required name="email" >
<label>Subject</label>
<select class="span12" name="subject" id="subject" required >
<option value="na" selected="">Choose One:</option>
<option value="service">General Customer Service</option>
<option value="suggestions">Suggestions</option>
<option value="product">Product Support</option>
</select>
<label>Message</label>
<textarea rows="8" class="input-xlarge span12" id="message" name="message" required ></textarea>
<button class="btn btn-primary pull-right" style="border-radius:0px;" type="submit">Send</button>
</form>
ビュー.py :-
@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')
AttributeError: 'Database' object has no attribute 'model' のエラーがあります。この問題を解決するのを手伝ってください。