From 3f0aa4cbb7e217366c55f258fa2d4fc606498951 Mon Sep 17 00:00:00 2001
From: ubq323 <ubq323>
Date: Fri, 18 Jun 2021 20:15:43 +0000
Subject: admin page with minimal things on. later once we have things, we can
 put other things on here.

---
 apioforum/admin.py                        | 14 ++++++++++++++
 apioforum/templates/admin/admin_page.html | 15 +++++++++++++++
 apioforum/templates/base.html             |  2 +-
 3 files changed, 30 insertions(+), 1 deletion(-)
 create mode 100644 apioforum/admin.py
 create mode 100644 apioforum/templates/admin/admin_page.html

diff --git a/apioforum/admin.py b/apioforum/admin.py
new file mode 100644
index 0000000..b11b735
--- /dev/null
+++ b/apioforum/admin.py
@@ -0,0 +1,14 @@
+from flask import (
+    Blueprint, render_template
+)
+from .db import get_db
+from .permissions import admin_required
+
+bp = Blueprint("admin",__name__,url_prefix="/admin")
+
+@bp.route("/")
+@admin_required
+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)
diff --git a/apioforum/templates/admin/admin_page.html b/apioforum/templates/admin/admin_page.html
new file mode 100644
index 0000000..f48c6c0
--- /dev/null
+++ b/apioforum/templates/admin/admin_page.html
@@ -0,0 +1,15 @@
+{% extends 'base.html' %}
+{% block header %}
+<h1>{% block title %}admin page{% endblock %}</h1>
+{% endblock %}
+
+{% block content %}
+<h2>admins</h2>
+<ul>
+    {% for admin in admins %}
+    <li>{{admin.username}}</li>
+    {% endfor %}
+</ul>
+<p>this page will have more things on it later, probably</p>
+{% endblock %}
+
diff --git a/apioforum/templates/base.html b/apioforum/templates/base.html
index aae49e3..bf3748f 100644
--- a/apioforum/templates/base.html
+++ b/apioforum/templates/base.html
@@ -22,7 +22,7 @@
 				<p>{{ g.user }}</p>
 
 				{% if is_admin %}
-				<p><a href="{{url_for('admin.adminpage')}}">admin</a></p>
+				<p><a href="{{url_for('admin.admin_page')}}">admin</a></p>
 				{% endif %}
     				
 				<p>
-- 
cgit v1.2.3