Added all users display page
This commit is contained in:
parent
624bf44e51
commit
663e499ee2
2 changed files with 13 additions and 1 deletions
12
templates/allusers.html
Normal file
12
templates/allusers.html
Normal 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>
|
2
user.py
2
user.py
|
@ -27,4 +27,4 @@ def get_user(id):
|
||||||
|
|
||||||
@app.route("/users/")
|
@app.route("/users/")
|
||||||
def all_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()])
|
Loading…
Reference in a new issue