From fc64b55dfd73e855b59183b541f018d3c9520b7d Mon Sep 17 00:00:00 2001 From: Daniel Grams Date: Mon, 8 Jun 2020 20:44:11 +0200 Subject: [PATCH] admin --- app.py | 12 +++++++++++- static/site.css | 3 --- templates/admin/admin.html | 17 +++++++++++++++++ templates/admin/admin_units.html | 15 +++++++++++++++ templates/layout.html | 5 +++++ 5 files changed, 48 insertions(+), 4 deletions(-) create mode 100644 templates/admin/admin.html create mode 100644 templates/admin/admin_units.html diff --git a/app.py b/app.py index 102e275..8c5c71b 100644 --- a/app.py +++ b/app.py @@ -1,7 +1,7 @@ import os from flask import Flask, render_template, request from flask_sqlalchemy import SQLAlchemy -from flask_security import Security, current_user, auth_required, hash_password, SQLAlchemySessionUserDatastore +from flask_security import Security, current_user, auth_required, roles_required, hash_password, SQLAlchemySessionUserDatastore from flask_babelex import Babel, gettext, lazy_gettext # Create app @@ -65,5 +65,15 @@ def home(): def profile(): return render_template('profile.html') +@app.route("/admin") +@roles_required("admin") +def admin(): + return render_template('admin/admin.html') + +@app.route("/admin/admin_units") +@roles_required("admin") +def admin_admin_units(): + return render_template('admin/admin_units.html') + if __name__ == '__main__': app.run() \ No newline at end of file diff --git a/static/site.css b/static/site.css index ceb4677..b16f467 100644 --- a/static/site.css +++ b/static/site.css @@ -1,6 +1,3 @@ -a, a:hover { - color: #009688; -} h1 { font-size: 1.8rem; diff --git a/templates/admin/admin.html b/templates/admin/admin.html new file mode 100644 index 0000000..f5dedb6 --- /dev/null +++ b/templates/admin/admin.html @@ -0,0 +1,17 @@ +{% extends "layout.html" %} +{% block title %} +{{ _('Admin') }} +{% endblock %} +{% block content %} + + + +
+ {{ _('Admin Units') }} +
+ +{% endblock %} \ No newline at end of file diff --git a/templates/admin/admin_units.html b/templates/admin/admin_units.html new file mode 100644 index 0000000..fe3df30 --- /dev/null +++ b/templates/admin/admin_units.html @@ -0,0 +1,15 @@ +{% extends "layout.html" %} +{% block title %} +{{ _('Admin Units') }} +{% endblock %} +{% block content %} + + + + +{% endblock %} \ No newline at end of file diff --git a/templates/layout.html b/templates/layout.html index b87b241..34cfec7 100644 --- a/templates/layout.html +++ b/templates/layout.html @@ -54,6 +54,11 @@