from flask import Flask, request, render_template from .database import Database from .config import * db = Database(DATABASE_PATH) app = Flask("jimbrella") @app.route("/admin") def admin_index(): umbrellas = db.read() statuses = Database.group_by_status(umbrellas) return render_template( "admin/index.html", umbrellas=umbrellas, available=statuses["available"], lent=statuses["lent"], overdue=Database.find_overdue(statuses["lent"]), ) @app.route("/admin/umbrellas") def admin_umbrellas(): umbrellas = db.read() return render_template( "admin/umbrellas.html", umbrellas=umbrellas, ) if __name__ == "__main__": app.run()