rpiwebapp-public/admin/admin.py

14 lines
453 B
Python
Raw Normal View History

from flask import Blueprint, flash, redirect, url_for, render_template
from flask_login import login_required, current_user
Admin = Blueprint("admin", __name__, template_folder="templates")
@Admin.route("/admin")
@login_required
def index():
if not current_user.is_admin:
flash("you must be an admin to access this page, login with an admin account.")
return redirect(url_for("login"))
return render_template("admin/index.html", title="Admin")