有问题的路线是直截了当的 -
@app.route('/user_access', methods=['GET', 'POST'])
@login_required
def user_access():
userlist = User.query.all()
username = current_user.username
return render_template("userlist.html", userlist=userlist, username=username)
模板也很简单......
{% extends "base.html" %}
{% block content %}
<div class="container">
<h2>Users with access to PCBevo </h2>
<table class="table">
<thead>
<tr>
<th>UserID</th>
<th>Email</th>
<tr>
</thead>
<tbody>
{% for record in userlist %}
<tr>
<td>{{record.username}}</td>
<td>{{record.email}}</td>/
</tr>
{% endfor %}
</tbody>
</table>
<p><a href="/register_user">Add a new user to the access list</a></p>
</div> <!-- /container -->
{% endblock %}
答案 0 :(得分:1)
在您的一个表格单元格后面有一个向前的斜杠:
<td>{{record.email}}</td>/