Table of members
This commit is contained in:
parent
e4e216dcc9
commit
71c45befa4
|
@ -1,10 +1,16 @@
|
||||||
from flask import Blueprint,render_template,session,redirect,url_for
|
from flask import Blueprint,render_template,session,redirect,url_for
|
||||||
from werkzeug.security import generate_password_hash
|
from werkzeug.security import generate_password_hash
|
||||||
|
|
||||||
|
from database import Member
|
||||||
|
|
||||||
admin = Blueprint('admin',__name__)
|
admin = Blueprint('admin',__name__)
|
||||||
|
|
||||||
@admin.route("/")
|
@admin.route("/")
|
||||||
def admin_page():
|
def admin_page():
|
||||||
if ( "username" in session):
|
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"))
|
return redirect(url_for("auth.login_page"))
|
||||||
|
|
||||||
|
@admin.route("/members")
|
||||||
|
def table_of_members():
|
||||||
|
return render_template("members.html", members=Member.select())
|
||||||
|
|
|
@ -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;
|
||||||
|
}
|
|
@ -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>
|
Loading…
Reference in New Issue