|
@ -1,4 +1,4 @@ |
|
|
from flask import Flask, render_template |
|
|
|
|
|
|
|
|
from flask import Flask, render_template, session, redirect, url_for |
|
|
from flask_bootstrap import Bootstrap |
|
|
from flask_bootstrap import Bootstrap |
|
|
from flask_moment import Moment |
|
|
from flask_moment import Moment |
|
|
from flask_wtf import FlaskForm |
|
|
from flask_wtf import FlaskForm |
|
@ -30,9 +30,8 @@ def internal_server_error(e): |
|
|
|
|
|
|
|
|
@app.route('/', methods=['GET', 'POST']) |
|
|
@app.route('/', methods=['GET', 'POST']) |
|
|
def index(): |
|
|
def index(): |
|
|
name = None |
|
|
|
|
|
form = NameForm() |
|
|
form = NameForm() |
|
|
if form.validate_on_submit(): |
|
|
if form.validate_on_submit(): |
|
|
name = form.name.data |
|
|
|
|
|
form.name.data = '' |
|
|
|
|
|
return render_template('index.html', form=form, name=name) |
|
|
|
|
|
|
|
|
session['name'] = form.name.data |
|
|
|
|
|
return redirect(url_for('index')) |
|
|
|
|
|
return render_template('index.html', form=form, name=session.get('name')) |