mirror of
https://github.com/EDeev/yandex_lyceum.git
synced 2026-06-15 11:01:04 +03:00
less 2
This commit is contained in:
parent
00a44e8216
commit
19b4e2b5e9
14 changed files with 233 additions and 0 deletions
14
WEB. HTML 2/loginform.py
Normal file
14
WEB. HTML 2/loginform.py
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
from flask_wtf import FlaskForm
|
||||
from wtforms import StringField, PasswordField, BooleanField, SubmitField
|
||||
from wtforms.validators import DataRequired
|
||||
|
||||
|
||||
class LoginForm(FlaskForm):
|
||||
id_user = StringField('Id астронавта', validators=[DataRequired()])
|
||||
pas_user = PasswordField('Пароль астронавта', validators=[DataRequired()])
|
||||
id_cap = StringField('Id капитана', validators=[DataRequired()])
|
||||
pas_cap = PasswordField('Пароль капитана', validators=[DataRequired()])
|
||||
# remember_me = BooleanField('Запомнить меня') <p>{{ form.remember_me() }} {{ form.remember_me.label }}</p>
|
||||
submit = SubmitField('Доступ')
|
||||
|
||||
|
||||
53
WEB. HTML 2/server.py
Normal file
53
WEB. HTML 2/server.py
Normal file
|
|
@ -0,0 +1,53 @@
|
|||
from flask import Flask, render_template, redirect
|
||||
from loginform import LoginForm
|
||||
|
||||
|
||||
app = Flask(__name__)
|
||||
app.config['SECRET_KEY'] = 'yandexlyceum_secret_key'
|
||||
|
||||
|
||||
@app.route('/')
|
||||
@app.route('/index')
|
||||
def index(label):
|
||||
param = {'label': 'И на Марсе будут яблони цвести!', 'title': label}
|
||||
return render_template('index.html', **param)
|
||||
|
||||
|
||||
@app.route('/training/<prof>')
|
||||
def training(prof):
|
||||
param = {'title': "Тренировки в полёте", "spec": prof}
|
||||
return render_template('training.html', **param)
|
||||
|
||||
|
||||
@app.route('/list_prof/<var>')
|
||||
def list_prof(var):
|
||||
param = {'title': "Список профессий", "var": var}
|
||||
return render_template('list_prof.html', **param)
|
||||
|
||||
|
||||
@app.route('/answer')
|
||||
@app.route('/auto_answer')
|
||||
def answer():
|
||||
param = {'title': "Анкета", 'surname': "Фёдоров", 'name': "Марк", 'education': "Среднее", 'profession': " Писатель",
|
||||
'sex': "Male", 'motivation': "Распространить хип-хоп в космос!", 'ready': "True"}
|
||||
return render_template('auto_answer.html', **param)
|
||||
|
||||
|
||||
@app.route('/login', methods=['GET', 'POST'])
|
||||
def login():
|
||||
param = {'title': "Аварийный доступ"}
|
||||
form = LoginForm()
|
||||
if form.validate_on_submit():
|
||||
return redirect('/success')
|
||||
return render_template('login.html', **param, form=form)
|
||||
|
||||
|
||||
@app.route('/distribution')
|
||||
def success():
|
||||
param = {'title': "По каютам!", "users": ['Ридли Скотт', 'Энди Уир', 'Марк Уотни', "Венката Капур",
|
||||
'Тедди Сандерс', 'Шон Бин']}
|
||||
return render_template('distribution.html', **param)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
app.run(port=8080, host='127.0.0.1')
|
||||
7
WEB. HTML 2/static/css/style.css
Normal file
7
WEB. HTML 2/static/css/style.css
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
h4.color_edit {
|
||||
color: "black";
|
||||
}
|
||||
|
||||
p.padmarging {
|
||||
margin-left: 20px;
|
||||
}
|
||||
BIN
WEB. HTML 2/static/img/kb1.jpg
Normal file
BIN
WEB. HTML 2/static/img/kb1.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 268 KiB |
BIN
WEB. HTML 2/static/img/kb2.jpg
Normal file
BIN
WEB. HTML 2/static/img/kb2.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 267 KiB |
BIN
WEB. HTML 2/static/img/mars_ico.png
Normal file
BIN
WEB. HTML 2/static/img/mars_ico.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 16 KiB |
15
WEB. HTML 2/templates/auto_answer.html
Normal file
15
WEB. HTML 2/templates/auto_answer.html
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
{% extends "base_two.html" %}
|
||||
|
||||
{% block content1 %}
|
||||
<div class="alert alert-light" role="alert">
|
||||
<h4><font color="#DCDCDC">И на Марсе будут яблони цвести!</font></h4>
|
||||
</div>
|
||||
|
||||
<h4 class="color_edit"><p style="padding-left: 60px">Фамилия: {{surname}}</p></h4>
|
||||
<h4 class="color_edit"><p style="padding-left: 60px">Имя: {{name}}</p></h4>
|
||||
<h4 class="color_edit"><p style="padding-left: 60px">Образование: {{education}}</p></h4>
|
||||
<h4 class="color_edit"><p style="padding-left: 60px">Профессия: {{profession}}</p></h4>
|
||||
<h4 class="color_edit"><p style="padding-left: 60px">Пол: {{sex}}</p></h4>
|
||||
<h4 class="color_edit"><p style="padding-left: 60px">Мотивация: {{motivation}}</p></h4>
|
||||
<h4 class="color_edit"><p style="padding-left: 60px">Готовы остаться на Марсе? {{ready}}</p></h4>
|
||||
{% endblock %}
|
||||
32
WEB. HTML 2/templates/base.html
Normal file
32
WEB. HTML 2/templates/base.html
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<!-- Required meta tags -->
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
|
||||
<!-- Bootstrap CSS -->
|
||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css"
|
||||
rel="stylesheet" integrity="sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3"
|
||||
crossorigin="anonymous">
|
||||
|
||||
<!-- <link rel="stylesheet" type="text/css" href="static/css/style.css" /> -->
|
||||
<title>{{title}}</title>
|
||||
</head>
|
||||
<body>
|
||||
<header>
|
||||
<nav class="navbar navbar-light bg-light">
|
||||
<div class="container-fluid">
|
||||
<a class="navbar-brand mb-0" href="#"><h1>Миссия Колонизация Марса</h1></a>
|
||||
<div class="navbar-text mb-0 h5">
|
||||
Mars One
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
</header>
|
||||
<!-- Begin page content -->
|
||||
<main role="main" class="container-fluid">
|
||||
{% block content1 %}{% endblock %}
|
||||
</main>
|
||||
</body>
|
||||
</html>
|
||||
10
WEB. HTML 2/templates/base_two.html
Normal file
10
WEB. HTML 2/templates/base_two.html
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
{% extends "base.html" %}
|
||||
|
||||
{% block content1 %}
|
||||
<div class="alert alert-light" role="alert">
|
||||
<h4><font color="#DCDCDC">И на Марсе будут яблони цвести!</font></h4>
|
||||
</div>
|
||||
<div class="container">
|
||||
{% block content2 %}{% endblock %}
|
||||
</div>
|
||||
{% endblock %}
|
||||
8
WEB. HTML 2/templates/distribution.html
Normal file
8
WEB. HTML 2/templates/distribution.html
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
{% extends "base_two.html" %}
|
||||
|
||||
{% block content2 %}
|
||||
<h1 align="center">Размещение по каютам</h1>
|
||||
{% for user in users %}
|
||||
<h3>{{ user }} - Каюта № {{ loop.index }} {% if loop.first %} - первый в очереди {% endif %}</h3>
|
||||
{% endfor %}
|
||||
{% endblock %}
|
||||
5
WEB. HTML 2/templates/index.html
Normal file
5
WEB. HTML 2/templates/index.html
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
{% extends "base.html" %}
|
||||
|
||||
{% block content1 %}
|
||||
<h4>{{label}}</h4>
|
||||
{% endblock %}
|
||||
27
WEB. HTML 2/templates/list_prof.html
Normal file
27
WEB. HTML 2/templates/list_prof.html
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
{% extends "base_two.html" %}
|
||||
|
||||
{% block content2 %}
|
||||
{% set all_prof = ['врач', "экзобиолог", "климатолог", "астрогеолог", "гляциолог", "метеоролог",
|
||||
'инженер-исследователь', "пилот", "строитель", "инженер по терраформированию",
|
||||
"специалист по радиационной защите", "инженер жизнеобеспечения", "оператор марсохода",
|
||||
"киберинженер", "штурман", "пилот дронов"] %}
|
||||
{% if var == "ol" %}
|
||||
<p class="h1">Список профессий</p>
|
||||
<div class="container">
|
||||
<ol>
|
||||
{% for p in all_prof %}
|
||||
<li class="h5">{{p}}</li>
|
||||
{% endfor %}
|
||||
</ol>
|
||||
</div>
|
||||
{% elif var == "ul" %}
|
||||
<p class="h1">Список профессий</p>
|
||||
<div class="container">
|
||||
{% for p in all_prof %}
|
||||
<li class="h5">{{p}}</li>
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% else %}
|
||||
<p class="h1">Индекс указан неправильно!</p>
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
45
WEB. HTML 2/templates/login.html
Normal file
45
WEB. HTML 2/templates/login.html
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
{% extends "base_two.html" %}
|
||||
|
||||
{% block content2 %}
|
||||
<h1><img src="../static/img/mars_ico.png">Аварийный доступ</h1><br>
|
||||
<form action="" method="post" novalidate>
|
||||
{{ form.hidden_tag() }}
|
||||
<p>
|
||||
<big>{{ form.id_user.label }}</big>><br>
|
||||
{{ form.id_user(class="form-control") }}<br>
|
||||
{% for error in form.id_user.errors %}
|
||||
<div class="alert alert-danger" role="alert">
|
||||
{{ error }}
|
||||
</div>
|
||||
{% endfor %}
|
||||
</p>
|
||||
<p>
|
||||
<big>{{ form.pas_user.label }}</big><br>
|
||||
{{ form.pas_user(class="form-control", type="password") }}<br>
|
||||
{% for error in form.pas_user.errors %}
|
||||
<div class="alert alert-danger" role="alert">
|
||||
{{ error }}
|
||||
</div>
|
||||
{% endfor %}
|
||||
</p>
|
||||
<p>
|
||||
<big>{{ form.id_cap.label }}</big><br>
|
||||
{{ form.id_cap(class="form-control") }}<br>
|
||||
{% for error in form.id_cap.errors %}
|
||||
<div class="alert alert-danger" role="alert">
|
||||
{{ error }}
|
||||
</div>
|
||||
{% endfor %}
|
||||
</p>
|
||||
<p>
|
||||
<big>{{ form.pas_cap.label }}</big><br>
|
||||
{{ form.pas_cap(class="form-control", type="password") }}<br>
|
||||
{% for error in form.pas_cap.errors %}
|
||||
<div class="alert alert-danger" role="alert">
|
||||
{{ error }}
|
||||
</div>
|
||||
{% endfor %}
|
||||
</p>
|
||||
<p>{{ form.submit(type="submit", class="btn btn-primary") }}</p>
|
||||
</form>
|
||||
{% endblock %}
|
||||
17
WEB. HTML 2/templates/training.html
Normal file
17
WEB. HTML 2/templates/training.html
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
{% extends "base_two.html" %}
|
||||
|
||||
{% block content2 %}
|
||||
{% set sin = ['врач', "экзобиолог", "климатолог", "астрогеолог", "гляциолог", "метеоролог"] %}
|
||||
{% set inj = ['инженер-исследователь', "пилот", "строитель", "инженер по терраформированию",
|
||||
"специалист по радиационной защите", "инженер жизнеобеспечения", "оператор марсохода",
|
||||
"киберинженер", "штурман", "пилот дронов"] %}
|
||||
{% if spec.lower() in sin %}
|
||||
<p class="text-center h2">Научные симуляторы</p>
|
||||
<p class="text-center"><img src="/static/img/kb1.jpg" class="img-fluid"></p>
|
||||
{% elif spec.lower() in inj %}
|
||||
<p class="text-center h2">Инженерные тренажеры</p>
|
||||
<p class="text-center"><img src="/static/img/kb2.jpg" class="img-fluid"></p>
|
||||
{% else %}
|
||||
<p class="text-center h1">В наших списках ваша профессия отсутствует!</p>
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
Loading…
Add table
Reference in a new issue