refactoring

This commit is contained in:
2022-11-05 14:06:09 +03:00
parent 3e31a404e8
commit 41cf36e7a5
4 changed files with 20 additions and 13 deletions

10
app.py
View File

@@ -12,7 +12,7 @@ db.init_app(app)
@app.route('/')
def index():
allUsetrs = User.query.all()
allUsetrs = User.query.order_by(User.FIO).all()
s = {}
for user in allUsetrs:
@@ -30,8 +30,11 @@ def index():
data['kolvo'] = '0'
s[user.FIO] = data
print(s)
return render_template('index.html', users = s )
@@ -55,6 +58,7 @@ def useradd():
userAdd = User(FIO=fio, dolgnost=dolgn)
db.session.add(userAdd)
db.session.commit()
return redirect(url_for('adminpage'))
@@ -71,4 +75,4 @@ def addprogul():
if __name__ == '__main__':
app.run(host='0.0.0.0', port='3800', debug=True)
app.run(host='0.0.0.0', port='3800', debug=True)