started work on contact form

This commit is contained in:
William Brawner 2016-03-09 18:49:33 -06:00
parent 24c4ef3ce9
commit f7935cc566
2 changed files with 15 additions and 3 deletions

View file

@ -4,13 +4,14 @@ from flask.ext.mysqldb import MySQL
import hashlib import hashlib
from flask_debugtoolbar import DebugToolbarExtension from flask_debugtoolbar import DebugToolbarExtension
from admin import admin from admin import admin
from flaskext.mail import Mail, Message
app = Flask(__name__) app = Flask(__name__)
app.config.from_pyfile('config.py') app.config.from_pyfile('config.py')
app.secret_key = app.config['SECRET_KEY'] app.secret_key = app.config['SECRET_KEY']
mysql = MySQL(app) mysql = MySQL(app)
toolbar = DebugToolbarExtension(app) toolbar = DebugToolbarExtension(app)
mail = Mail(app)
app.register_blueprint(admin, url_prefix='/admin') app.register_blueprint(admin, url_prefix='/admin')
@ -54,9 +55,14 @@ def blog_post(url):
def projects(): def projects():
return render_template('projects.html') return render_template('projects.html')
@app.route('/contact') @app.route('/contact', methods=['GET', 'POST'])
def contact(): def contact():
return render_template('contact.html') if request.method == 'POST':
request.form['name']
request.form['email']
request.form['message']
else:
return render_template('contact.html')
@app.route('/login', methods=['GET', 'POST']) @app.route('/login', methods=['GET', 'POST'])
def login(): def login():

View file

@ -2,6 +2,12 @@
{% block body %} {% block body %}
<div class="section" id="contact"> <div class="section" id="contact">
<h2>contact</h2> <h2>contact</h2>
<form method="{{ url_for('contact') }}">
<input type="text" name="name">
<input type="text" name="email">
<textarea name="message"></textarea>
<input type="submit" value="submit">
</form>
<div class="one-half"> <div class="one-half">
<a class="twitter-timeline" href="https://twitter.com/BillyBrawner1" data-widget-id="706308392311136256">Tweets by @BillyBrawner1</a> <a class="twitter-timeline" href="https://twitter.com/BillyBrawner1" data-widget-id="706308392311136256">Tweets by @BillyBrawner1</a>
<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+"://platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script> <script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+"://platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>