def out(un): db = get_db() dbase = FDataBase(db) res = dbase.get_by_number(un) na = res['Name'] sna = res['Surname'] st = res['Status'] f = res['Foto'] t = datetime.now() dbase.add_entery(un, na, sna, st, f, 'Вышел', t) return redirect('/')
def index_post(): db = get_db() dbase = FDataBase(db) un = request.form['UN'] tmp = dbase.get_by_number(un) if tmp != False: global _current_un _current_un = un na = tmp['Name'] sna = tmp['Surname'] st = tmp['status'] f = tmp['Foto'] t = datetime.now() dbase.add_entery(un, na, sna, st, f, 'Зашол', t) foto = '/static/image/'+f flash('Успешный вход ', category='success') return render_template('profile.html', UN=un, Status=st, Name=na, Surname=sna,Foto=foto) else: flash('Ошибка входа ', category='error') return render_template('index.html', UN=0)