mirror of
https://github.com/minetest/contentdb.git
synced 2025-01-08 22:17:34 +01:00
Add user list
This commit is contained in:
parent
4898b69ea0
commit
f51224a8d5
18
app/templates/users/list.html
Normal file
18
app/templates/users/list.html
Normal file
@ -0,0 +1,18 @@
|
||||
{% extends "base.html" %}
|
||||
|
||||
{% block title %}
|
||||
Users
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<ul>
|
||||
{% for user in users %}
|
||||
<li>
|
||||
<a href="{{ url_for('user_profile_page', username=user.username) }}">
|
||||
{{ user.display_name }}
|
||||
</a> -
|
||||
{{ user.rank.getTitle() }} -
|
||||
{{ user.packages.count() }} packages.
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% endblock %}
|
@ -20,12 +20,13 @@ class UserProfileForm(FlaskForm):
|
||||
display_name = StringField("Display name")
|
||||
submit = SubmitField("Save")
|
||||
|
||||
@app.route("/user/", methods=["GET"])
|
||||
@login_required
|
||||
def self_user_profile_page():
|
||||
return redirect(url_for("user_profile_page", username=current_user.username))
|
||||
@app.route("/users/", methods=["GET"])
|
||||
def user_list_page():
|
||||
users = User.query.all()
|
||||
return render_template("users/list.html", users=users)
|
||||
|
||||
@app.route("/user/<username>/", methods=["GET", "POST"])
|
||||
|
||||
@app.route("/users/<username>/", methods=["GET", "POST"])
|
||||
def user_profile_page(username):
|
||||
user = User.query.filter_by(username=username).first()
|
||||
if not user:
|
||||
|
Loading…
Reference in New Issue
Block a user