@app.route('/')
@app.route('/index', methods=['GET', 'POST'])
def index():
us = User()
if request.method == 'POST' and us.validate_on_submit():
name = request.us.get('name')
sex = request.us.get('sex')
age = request.us.get('age')
weight = request.us.get('weight')
height = request.us.get('height')
submit = request.us.get('submit')
return redirect(url_for("home"))
return render_template("index.html", name = us.name, sex = us.sex, age = us.age, weight = us.weight,
height = us.height, nationality = nationality_list, submit = us.submit, us = us, title="Sign")
@app.route('/index/home/', methods=["GET", "POST"])
def home():
us = User()
if request.method == 'POST' and us.validate_on_submit():
flash('cvvv')
return render_template("home.html", us=us)
<!DOCTYPE html>
<html><head>
<meta charset="UTF-8" content="width=device-width; initial-scale=1.0" charset="UTF-8">
{% if title %}
<title>{{title}} - microblog</title>
{% else %}
<title>microblog</title>
{% endif %}
<link rel="stylesheet" href="{{ url_for('static', filename='style.css') }}">
</head>
<body>
<article>
<header class="head"><h1>Hello! Here you can fill out the form</h1></header>
<div class="container">
{%if us.errors%}
{% for field, errors in us.errors.items() %}
{{ ', '.join(errors) }}
{% endfor %}
{%endif%}
<div class="one">
<form class = "form" action = "{{ url_for('index')}}" method = "post">
{{us.csrf_token()}}
<legend class="h" align = center><h2>Please, input your data</h2></legend>
<div class="input_text">
{{us.name.label}}
{{us.name}}
</div>
<div class="input_text">
{{sex.label}}
{{sex(size=20)}}
</div>
<div class="input_text">
{{age.label}}
{{age(size=20)}}
</div>
<div class="input_text">
{{weight.label}}
{{weight(size=20)}}
</div>
<div class="input_text">
{{height.label}}
{{height(size=20)}}
</div>
<div class="input_text">
Nationality:
<select name="{{nationality.label}}">
{% for i in nationality%}
<option value="{i}">{{i}}</option>
{% endfor %}</select>
</div>
<div align=center>
<input class="button" type="submit", value="Press me softly", onclick="loading();">
</div>
</form> </div>
</article>
<footer>
<p align=center>@by Polina Lebedeva</p>
</footer>
</body>
</html>