add route to all forms
This commit is contained in:
16
app.py
16
app.py
@@ -28,17 +28,29 @@ def adminpage():
|
||||
@app.route('/adduser', methods=['GET', 'POST'])
|
||||
def useradd():
|
||||
if request.method == 'POST':
|
||||
"""
|
||||
fio = request.form['fio']
|
||||
dolgn = request.form['dolgnost']
|
||||
userAdd = User(FIO=fio, dolgnost=dolgn)
|
||||
db.session.add(userAdd)
|
||||
db.session.commit()
|
||||
"""
|
||||
print('add user')
|
||||
return redirect(url_for('adminpage'))
|
||||
|
||||
|
||||
@app.route('/addprogul')
|
||||
@app.route('/addprogul', methods=['GET', 'POST'])
|
||||
def addprogul():
|
||||
pass
|
||||
if request.method == 'POST':
|
||||
print("add progul ")
|
||||
|
||||
""""
|
||||
dataproeba = request.form['dateprogul']
|
||||
sotrId = request.form['sotrudnil']
|
||||
print(dataproeba)
|
||||
print(sotrId)
|
||||
"""
|
||||
return redirect(url_for('adminpage'))
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
||||
@@ -18,21 +18,20 @@
|
||||
</header>
|
||||
|
||||
|
||||
|
||||
<div class="container card">
|
||||
<form method="post" enctype=multipart/form-data action="/addprogul">
|
||||
|
||||
<h2>Добавить прогул</h2>
|
||||
<label> Выберите сотрудника из списка ниже </label>
|
||||
<select class="form-select" aria-label="Default select example">
|
||||
{% for key, value in users.items() %}
|
||||
<form method=post enctype=multipart/form-data action="/addprogul">
|
||||
|
||||
|
||||
<label> Выберите сотрудника из списка ниже </label>
|
||||
<select class="form-select" name="sotrudnik">
|
||||
{% for key, value in users.items() %}
|
||||
<option value="{{key}}">{{value}}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
<label for="startDate">Выберите дату прогула</label>
|
||||
<input id="startDate" class="form-control" type="date" />
|
||||
<button type="button" class="btn btn-primary">Добавить</button>
|
||||
<input id="startDate" class="form-control" type="date" name='dateprogul' />
|
||||
<button type="submit" class="btn btn-primary">Добавить</button>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
@@ -40,7 +39,7 @@
|
||||
<div class="container card">
|
||||
<h2>
|
||||
Добавить сотрудника
|
||||
|
||||
</h2>
|
||||
<form method="post" enctype=multipart/form-data action="/adduser">
|
||||
<div class="mb-3">
|
||||
<label>ФИО сотрудника</label>
|
||||
@@ -48,19 +47,16 @@
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="exampleInputPassword1" class="form-label">Должность</label>
|
||||
<select class="form-select" name="dolgnost" aria-label="Default select example">
|
||||
<select class="form-select" name="dolgnost">
|
||||
<option value="laborant">Лаборант</option>
|
||||
<option value="ingener">Инженер</option>
|
||||
<option value="vedingener">Ведущий инженер</option>
|
||||
</select>
|
||||
<button type="submit" class="btn btn-primary">Добавить</button>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
|
||||
</h2>
|
||||
</div>
|
||||
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
||||
Reference in New Issue
Block a user