Table of members

This commit is contained in:
hok7z 2022-12-10 15:14:21 +02:00
parent e4e216dcc9
commit 71c45befa4
3 changed files with 64 additions and 1 deletions

View File

@ -1,10 +1,16 @@
from flask import Blueprint,render_template,session,redirect,url_for
from werkzeug.security import generate_password_hash
from database import Member
admin = Blueprint('admin',__name__)
@admin.route("/")
def admin_page():
if ( "username" in session):
return render_template("index.html",username=session["username"])
return render_template("index.html", username=session["username"])
return redirect(url_for("auth.login_page"))
@admin.route("/members")
def table_of_members():
return render_template("members.html", members=Member.select())

View File

@ -0,0 +1,17 @@
table, th, td {
border: 1px solid;
}
table {
margin: 2% 0;
border-collapse: collapse;
}
th, td {
padding: 15px;
text-align: left;
}
tr:hover {
background-color: #dddddd;
}

40
templates/members.html Normal file
View File

@ -0,0 +1,40 @@
<!DOCTYPE html>
<html lang="en">
<head>
<link href="../static/css/table-members.css" rel="stylesheet">
</head>
<body>
<table>
<thead>
<tr>
<th>id</th>
<th>first name</th>
<th>username</th>
<th>role</th>
<th>warnings</th>
<th>join date</th>
</tr>
</thead>
<tbody>
{% for member in members %}
<tr>
<td>{{member.user_id}}</td>
<td>{{member.first_name}}</td>
{% if member.username %}
<td>{{member.username}}</td>
{% else %}
<td></td>
{% endif %}
<td>{{member.role}}</td>
<td>{{member.warns}}</td>
<td>{{member.joined}}</td>
</tr>
{% endfor %}
</tbody>
</table>
</body>
</html>