Added all users display page

This commit is contained in:
Robbe Van Herck 2018-07-17 10:04:57 +02:00
parent 624bf44e51
commit 663e499ee2
No known key found for this signature in database
GPG key ID: 4D1C8E8FBD1C7188
2 changed files with 13 additions and 1 deletions

12
templates/allusers.html Normal file
View file

@ -0,0 +1,12 @@
<html>
<body>
<h2>Insert cool name here</h2>
<ul>
{% for user in data -%}
<li>
<a href="{{url_for('get_user', id=user.id)}}">{{ user.id }}</a>: {{ user.achievements|length }} achievement{{ "s" if (user.achievements|length != 1) else "" }}
</li>
{% endfor -%}
</ul>
</body>
</html>

View file

@ -27,4 +27,4 @@ def get_user(id):
@app.route("/users/")
def all_users():
return json.dumps([user.to_obj() for user in User.query.all()])
return render_template("allusers.html", data=[user.to_obj() for user in User.query.all()])