diff options
author | citrons <citrons@mondecitronne.com> | 2025-06-14 19:03:26 -0500 |
---|---|---|
committer | ubq323 <ubq323@ubq323.website> | 2025-06-15 12:20:07 +0100 |
commit | 72dd59cb0be36b19b97039b7bfe955f355ae8588 (patch) | |
tree | 4fd0e18465337b4edf7c1bae9e3aa197d5cb940c | |
parent | 69240eafea18a4505bedc60cc9f79aa38ac9abd1 (diff) |
user list admin page
-rw-r--r-- | apioforum/admin.py | 7 | ||||
-rw-r--r-- | apioforum/templates/admin/admin_page.html | 6 | ||||
-rw-r--r-- | apioforum/templates/admin/users.html | 14 |
3 files changed, 25 insertions, 2 deletions
diff --git a/apioforum/admin.py b/apioforum/admin.py index f96b0c8..e591a79 100644 --- a/apioforum/admin.py +++ b/apioforum/admin.py @@ -12,3 +12,10 @@ def admin_page(): db = get_db() admins = db.execute("select * from users where admin > 0;").fetchall() return render_template("admin/admin_page.html",admins=admins) + +@bp.route("/users") +@admin_required +def user_list(): + db = get_db() + users = db.execute("select * from users order by joined desc;").fetchall() + return render_template("admin/users.html",users=users) diff --git a/apioforum/templates/admin/admin_page.html b/apioforum/templates/admin/admin_page.html index fb558bf..482ae68 100644 --- a/apioforum/templates/admin/admin_page.html +++ b/apioforum/templates/admin/admin_page.html @@ -7,9 +7,11 @@ <h2>admins</h2> <ul> {% for admin in admins %} - <li>{{admin.username}}</li> + <li>{{disp_user(admin.username)}}</li> {% endfor %} </ul> -<p>this page will have more things on it later, probably</p> +<p> + <a class="actionbutton" href="{{url_for('admin.user_list')}}">user list</a> +</p> {% endblock %} diff --git a/apioforum/templates/admin/users.html b/apioforum/templates/admin/users.html new file mode 100644 index 0000000..62212e0 --- /dev/null +++ b/apioforum/templates/admin/users.html @@ -0,0 +1,14 @@ +{% extends 'base.html' %} +{% block header %} +<h1>{% block title %}all apioforum users{% endblock %}</h1> +{% endblock %} + +{% block content %} +<h2>all users</h2> +<ul> + {% for user in users %} + <li>{{disp_user(user.username)}}</li> + {% endfor %} +</ul> +{% endblock %} + |