from flask import Blueprint, flash, redirect, render_template, url_for
from flask_login import current_user, login_required

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")
