diff options
Diffstat (limited to 'jimbrella/web.py')
-rw-r--r-- | jimbrella/web.py | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/jimbrella/web.py b/jimbrella/web.py new file mode 100644 index 0000000..6446329 --- /dev/null +++ b/jimbrella/web.py @@ -0,0 +1,25 @@ +from flask import Flask, request, render_template +from .database import Database +from .utils import group_by_status +from .config import * + +db = Database(DATABASE_PATH) + +app = Flask("jimbrella") + + +@app.route("/") +def index(): + umbrellas = db.read() + statuses = group_by_status(umbrellas) + return render_template( + "index.html", + total=len(umbrellas), + available=len(statuses["available"]), + lent=len(statuses["lent"]), + overdue="Not Yet Implemented", + ) + + +if __name__ == "__main__": + app.run() |