Created
August 20, 2018 04:44
-
-
Save marknagelberg/a59dc1feb241dd02687be6b97d06fc1e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from flask import Flask, render_template, Blueprint | |
from .forms import NameForm | |
from .models import Name | |
from . import db | |
bp = Blueprint('app', __name__) | |
@bp.route('/', methods=['GET', 'POST']) | |
def home(): | |
form = NameForm() | |
if form.validate_on_submit(): | |
db.session.add(Name(name=form.name.data)) | |
db.session.commit() | |
return render_template('index.html', form=form) | |
return render_template('index.html', form=form) | |
if __name__ == '__main__': | |
app.run(debug=True) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment