let emailAddress = document.querySelector('[tabindex="0"]');
let nativeInputValueSetter = Object.getOwnPropertyDescriptor(window.HTMLInputElement.prototype, 'value').set;
nativeInputValueSetter.call(emailAddress, 'Ваше_Значение');
let inputEvent = new Event('input', { bubbles: true });
emailAddress.dispatchEvent(inputEvent);
u_id = get_userid()
rows = Stat.query.filter_by(user_id = u_id).update({'user_id': 1})
db.session.commit()
<thead>
<tr>
<th>ID</th>
...
</tr>
</thead>
<tbody>
{% for user in users %}
<tr>
<td>{{ user.id }}</td>
...
<td><a href="/user/delete/{{ user.id }}">Удалить</a></td>
</tr>
{% endfor %}
</tbody>
@app.route('/user/delete/<int:id>')
def delete_user(id):
# # Здесь удаляете пользователя по id.
# User.query.filter_by(id=id).delete()
# db.session.commit()
...
if User.query.get(5):
from flask_login import login_required, current_user
@app.route('/secret_page')
@login_required
def secret_page():
if current_user.get_id() == 5:
return render_template('test.html', title='Страница',)
return redirect(url_for('index'))