From 4967496d49f54dd6c652f673063c0a6a621aaafe Mon Sep 17 00:00:00 2001 From: Mo8it Date: Sun, 18 Apr 2021 16:14:03 +0200 Subject: [PATCH] Updated packages, moved title to templates --- advlabdb/forms.py | 2 +- advlabdb/routes.py | 31 ++++-------- advlabdb/templates/appointments.html | 1 + advlabdb/templates/assistants.html | 1 + advlabdb/templates/experiments.html | 1 + advlabdb/templates/groups.html | 1 + advlabdb/templates/index.html | 1 + advlabdb/templates/register.html | 4 +- advlabdb/templates/registered.html | 1 + advlabdb/templates/semesters.html | 1 + advlabdb/templates/students.html | 1 + advlabdb/templates/users.html | 3 +- poetry.lock | 70 ++++++++++++++-------------- 13 files changed, 56 insertions(+), 62 deletions(-) diff --git a/advlabdb/forms.py b/advlabdb/forms.py index bc47534..1f2d09d 100644 --- a/advlabdb/forms.py +++ b/advlabdb/forms.py @@ -7,7 +7,7 @@ from advlabdb.models import User class RegistrationForm(FlaskForm): email = StringField("Email", validators=[DataRequired(), Email()]) - admin = BooleanField("Admin") + admin = BooleanField("Admin", default=False) submit = SubmitField("Register") def validate_email(self, email): diff --git a/advlabdb/routes.py b/advlabdb/routes.py index 36b4330..8efddfa 100644 --- a/advlabdb/routes.py +++ b/advlabdb/routes.py @@ -93,9 +93,7 @@ def students(): tablesLabels.append("Part " + part.label + ":") tables.append(makeTable(headerAndDataList=headerAndDataList, rows=part.part_students)) - title = "Students" - return render_template(titleToTemplate(title) + ".html", - title=title, + return render_template("students.html", tables=tables, tablesLabels=tablesLabels, ) @@ -118,9 +116,7 @@ def assistants(): table = makeTable(headerAndDataList=headerAndDataList, rows=Assistant.query.filter(Assistant.user_id != None).all()) - title = "Assistants" - return render_template(titleToTemplate(title) + ".html", - title=title, + return render_template("assistants.html", table=table, ) @@ -143,9 +139,7 @@ def experiments(): tables.append(makeTable(headerAndDataList=headerAndDataList, rows=part.part_experiments)) - title = "Experiments" - return render_template(titleToTemplate(title) + ".html", - title=title, + return render_template("experiments.html", tables=tables, tablesLabels=tablesLabels, ) @@ -154,9 +148,7 @@ def experiments(): @app.route("/appointments") @roles_required("admin") def appointments(): - title = "Appointments" - return render_template(titleToTemplate(title) + ".html", - title=title, + return render_template("appointments.html", ) @@ -179,9 +171,7 @@ def groups(): tables.append(makeTable(headerAndDataList=headerAndDataList, rows=part.groups)) - title = "Groups" - return render_template(titleToTemplate(title) + ".html", - title=title, + return render_template("groups.html", tables=tables, tablesLabels=tablesLabels, ) @@ -202,9 +192,7 @@ def users(): rows=User.query.filter(User.active == True).all(), tableId="usersTab") - title = "Users" - return render_template(titleToTemplate(title) + ".html", - title=title, + return render_template("users.html", table=table, ) @@ -239,9 +227,7 @@ def semesters(): table = makeTable(headerAndDataList=headerAndDataList, rows=Semester.query.all()) - title = "Semesters" - return render_template(titleToTemplate(title) + ".html", - title=title, + return render_template("semesters.html", table=table, ) @@ -254,6 +240,7 @@ def set_semester(): @app.route("/register", methods=["GET", "POST"]) +@roles_required("admin") def register(): form = RegistrationForm() if form.validate_on_submit(): @@ -272,12 +259,10 @@ def register(): user_datastore.create_user(email=email, password=passwordHash, roles=roles) db.session.commit() return render_template("registered.html", - title="Registered", email=email, password=password, admin=admin, ) return render_template("register.html", - title="Register", form=form, ) diff --git a/advlabdb/templates/appointments.html b/advlabdb/templates/appointments.html index 39e893d..c0ecb70 100644 --- a/advlabdb/templates/appointments.html +++ b/advlabdb/templates/appointments.html @@ -1,3 +1,4 @@ +{% set title = "Appointments" %} {% extends "layout.html" %} {% block content %} {% endblock content %} diff --git a/advlabdb/templates/assistants.html b/advlabdb/templates/assistants.html index 31810f8..3768ea1 100644 --- a/advlabdb/templates/assistants.html +++ b/advlabdb/templates/assistants.html @@ -1,3 +1,4 @@ +{% set title = "Assistants" %} {% extends "layout.html" %} {% block content %} diff --git a/advlabdb/templates/experiments.html b/advlabdb/templates/experiments.html index f87c4aa..cc5acc6 100644 --- a/advlabdb/templates/experiments.html +++ b/advlabdb/templates/experiments.html @@ -1,3 +1,4 @@ +{% set title = "Experiments" %} {% extends "layout.html" %} {% block content %} diff --git a/advlabdb/templates/groups.html b/advlabdb/templates/groups.html index f87c4aa..e03ca1d 100644 --- a/advlabdb/templates/groups.html +++ b/advlabdb/templates/groups.html @@ -1,3 +1,4 @@ +{% set title = "Groups" %} {% extends "layout.html" %} {% block content %} diff --git a/advlabdb/templates/index.html b/advlabdb/templates/index.html index d2f6365..981c57d 100644 --- a/advlabdb/templates/index.html +++ b/advlabdb/templates/index.html @@ -1,3 +1,4 @@ +{% set title = "Home" %} {% extends "layout.html" %} {% block content %} Welcome on AdvLabDB! diff --git a/advlabdb/templates/register.html b/advlabdb/templates/register.html index 59c28f9..5a1549d 100644 --- a/advlabdb/templates/register.html +++ b/advlabdb/templates/register.html @@ -1,8 +1,8 @@ +{% set title = "Register" %} {% extends "layout.html" %} {% block content %}
-
- {{form.hidden_tag()}} +
{{form.email.label(class="form-control-label")}} diff --git a/advlabdb/templates/registered.html b/advlabdb/templates/registered.html index 25e9643..1b3b480 100644 --- a/advlabdb/templates/registered.html +++ b/advlabdb/templates/registered.html @@ -1,3 +1,4 @@ +{% set title = "Registered" %} {% extends "layout.html" %} {% block content %}

diff --git a/advlabdb/templates/semesters.html b/advlabdb/templates/semesters.html index 31810f8..adfa80a 100644 --- a/advlabdb/templates/semesters.html +++ b/advlabdb/templates/semesters.html @@ -1,3 +1,4 @@ +{% set title = "Semesters" %} {% extends "layout.html" %} {% block content %} diff --git a/advlabdb/templates/students.html b/advlabdb/templates/students.html index f87c4aa..4fb04d3 100644 --- a/advlabdb/templates/students.html +++ b/advlabdb/templates/students.html @@ -1,3 +1,4 @@ +{% set title = "Students" %} {% extends "layout.html" %} {% block content %} diff --git a/advlabdb/templates/users.html b/advlabdb/templates/users.html index f3a0fde..ff50bd1 100644 --- a/advlabdb/templates/users.html +++ b/advlabdb/templates/users.html @@ -1,3 +1,4 @@ +{% set title = "Users" %} {% extends "layout.html" %} {% block content %} @@ -7,7 +8,7 @@


- + {% endblock content %} diff --git a/poetry.lock b/poetry.lock index baf631e..1d25c37 100644 --- a/poetry.lock +++ b/poetry.lock @@ -191,7 +191,7 @@ totp = ["cryptography"] [[package]] name = "sqlalchemy" -version = "1.4.8" +version = "1.4.9" description = "Database Abstraction Library" category = "main" optional = false @@ -408,40 +408,40 @@ passlib = [ {file = "passlib-1.7.4.tar.gz", hash = "sha256:defd50f72b65c5402ab2c573830a6978e5f202ad0d984793c8dde2c4152ebe04"}, ] sqlalchemy = [ - {file = "SQLAlchemy-1.4.8-cp27-cp27m-macosx_10_14_x86_64.whl", hash = "sha256:dec822c2a9436092798998475b3b8edd0d59be7fecdd5fb8411ac8db1575ed64"}, - {file = "SQLAlchemy-1.4.8-cp27-cp27m-manylinux1_x86_64.whl", hash = "sha256:15480706c51bdf72d726d0efde77eef6b5f09fbef65bc520f2c4e1f3a429fddf"}, - {file = "SQLAlchemy-1.4.8-cp27-cp27m-win32.whl", hash = "sha256:221ead411c5e455bbe32b8eb2e8521a31a0769684a93b6895e515e9ce3a49906"}, - {file = "SQLAlchemy-1.4.8-cp27-cp27m-win_amd64.whl", hash = "sha256:46a454a366f6274c18d3204d11b9e4b98a5c99cba99230e24848d82bef069f75"}, - {file = "SQLAlchemy-1.4.8-cp27-cp27mu-manylinux1_x86_64.whl", hash = "sha256:81ea6270359629b9c56251bdfc12f2a8afb55034a3ff3698b6a764b300bfe605"}, - {file = "SQLAlchemy-1.4.8-cp36-cp36m-macosx_10_14_x86_64.whl", hash = "sha256:831aa088b0056b8040423c53543b5bf5663d1d5ffbc175387f2216de7780113e"}, - {file = "SQLAlchemy-1.4.8-cp36-cp36m-manylinux1_x86_64.whl", hash = "sha256:b8280da3f36b9156ff251a14e5a3e82a4bb58958bdddbd0867cd29e6f3f809de"}, - {file = "SQLAlchemy-1.4.8-cp36-cp36m-manylinux2010_x86_64.whl", hash = "sha256:767c0bbe5af14c2ebcad7314faea9709b59593daa3250fe6224429a344c21438"}, - {file = "SQLAlchemy-1.4.8-cp36-cp36m-manylinux2014_aarch64.whl", hash = "sha256:8a067fbf3ea3f53e4223990d92a8e44259571ef182039ddcb4ffcf217e08a901"}, - {file = "SQLAlchemy-1.4.8-cp36-cp36m-manylinux2014_x86_64.whl", hash = "sha256:43b4958d959b1ee00540b963620f6bffacdd8ac0a19d31450828a1cbacf3693c"}, - {file = "SQLAlchemy-1.4.8-cp36-cp36m-win32.whl", hash = "sha256:b6106343fb97771f20cd945ce6b1d07f8247121d1d4baad062c028e5f0a1f034"}, - {file = "SQLAlchemy-1.4.8-cp36-cp36m-win_amd64.whl", hash = "sha256:fc5dea79bd2626ee2ed034144f6c590441e7c8c036c57c1939ec4a18481c0de1"}, - {file = "SQLAlchemy-1.4.8-cp37-cp37m-macosx_10_14_x86_64.whl", hash = "sha256:1dc4f31124cc359065dceef1a9afe4e2d07a05b2e1e184f5fa48cba96c2249a3"}, - {file = "SQLAlchemy-1.4.8-cp37-cp37m-manylinux1_x86_64.whl", hash = "sha256:c1457a86209c56dfdd1a62904445bc727f962226bf8866f3834fffff8bd7282d"}, - {file = "SQLAlchemy-1.4.8-cp37-cp37m-manylinux2010_x86_64.whl", hash = "sha256:ddc9de7e46e8044099a94b8d8b92b02693df030ca8684aa775908295270a3556"}, - {file = "SQLAlchemy-1.4.8-cp37-cp37m-manylinux2014_aarch64.whl", hash = "sha256:6d18aec6f16b48b2903940776d0f455d82b0c35f4b307ae5393987c600f8fcda"}, - {file = "SQLAlchemy-1.4.8-cp37-cp37m-manylinux2014_x86_64.whl", hash = "sha256:64a6645ee39f45f153b45addace5727aef7eb517b115c8bdc77e02be8c8c43a3"}, - {file = "SQLAlchemy-1.4.8-cp37-cp37m-win32.whl", hash = "sha256:d37683c5d84f0694f159a2a515a34f81daf7da96e7efb9ba9d5daf4ae8dde47e"}, - {file = "SQLAlchemy-1.4.8-cp37-cp37m-win_amd64.whl", hash = "sha256:de2e700a2e98b4c621976fdb3174e9e5947c38efedcf60e6d7c20cc7dddb3a99"}, - {file = "SQLAlchemy-1.4.8-cp38-cp38-macosx_10_14_x86_64.whl", hash = "sha256:e7a4bcb79aa64f1bf995dc2f5966fccc7d21b99cdfb63b57c609cfdba2ea5906"}, - {file = "SQLAlchemy-1.4.8-cp38-cp38-manylinux1_x86_64.whl", hash = "sha256:fccd2de1b3b47ca62c2fa5d344e16266a6edc8cce8b80f32e40126df60dbd2c4"}, - {file = "SQLAlchemy-1.4.8-cp38-cp38-manylinux2010_x86_64.whl", hash = "sha256:ed660a67c0d8690078560d62767a69b359409863827b367167f18fa14ca51ff6"}, - {file = "SQLAlchemy-1.4.8-cp38-cp38-manylinux2014_aarch64.whl", hash = "sha256:fe2558be48c92a9be69bd9e7c41bfc46714c5eafc4d59f85fdc338d6999c4962"}, - {file = "SQLAlchemy-1.4.8-cp38-cp38-manylinux2014_x86_64.whl", hash = "sha256:859cf5aae0ecc1aa526f9cebdf6ae8078527f0f3aa3fb10156ecc1d044c1c545"}, - {file = "SQLAlchemy-1.4.8-cp38-cp38-win32.whl", hash = "sha256:4b0404b7a18658d5661120ae0f6f57b220c57126d07a067bfdff304d4c50eaa3"}, - {file = "SQLAlchemy-1.4.8-cp38-cp38-win_amd64.whl", hash = "sha256:49a85c143f90c74b1d000506e125476d4dec3342f8052ad98e007fb5c657c46c"}, - {file = "SQLAlchemy-1.4.8-cp39-cp39-macosx_10_14_x86_64.whl", hash = "sha256:29e135f8c890c16251162dd40022074430fc39668c8666220a73cb500a3697af"}, - {file = "SQLAlchemy-1.4.8-cp39-cp39-manylinux1_x86_64.whl", hash = "sha256:a7641c8a2d008ee8cef21d3b9eaf7f68259b965318055148fbc5ae6961ae287e"}, - {file = "SQLAlchemy-1.4.8-cp39-cp39-manylinux2010_x86_64.whl", hash = "sha256:aa470facb52b927a5a5a1a4755b1452f7e77dcf93e822077354075e7a811bec2"}, - {file = "SQLAlchemy-1.4.8-cp39-cp39-manylinux2014_aarch64.whl", hash = "sha256:76354282fbb3e5b33aee8fcfc2394c7b26d08c53025960d41abc57a6222321cc"}, - {file = "SQLAlchemy-1.4.8-cp39-cp39-manylinux2014_x86_64.whl", hash = "sha256:cb08be4a43ce6729b37efb95816258b00bbd3442eef4a740c09384fb9fe99076"}, - {file = "SQLAlchemy-1.4.8-cp39-cp39-win32.whl", hash = "sha256:eff2c66e930030110a6139b0374013fa1f1a397a67a0c8a1a5d387ca2a112b45"}, - {file = "SQLAlchemy-1.4.8-cp39-cp39-win_amd64.whl", hash = "sha256:1e1c2c65f732f7740d184b4133e5207c0f8974663ab1b79ce1b599ecf55bd3e9"}, - {file = "SQLAlchemy-1.4.8.tar.gz", hash = "sha256:3bc31ad707f8587c9f93d50cd7cee80ba352162d322808ddbb5bcb5fcfd2bb83"}, + {file = "SQLAlchemy-1.4.9-cp27-cp27m-macosx_10_14_x86_64.whl", hash = "sha256:e26791ac43806dec1f18d328596db87f1b37f9d8271997dd1233054b4c377f51"}, + {file = "SQLAlchemy-1.4.9-cp27-cp27m-manylinux1_x86_64.whl", hash = "sha256:c4485040d86d4b3d9aa509fd3c492de3687d9bf52fb85d66b33912ad068a088c"}, + {file = "SQLAlchemy-1.4.9-cp27-cp27m-win32.whl", hash = "sha256:a8763fe4de02f746666161b130cc3e5d1494a6f5475f5622f05251739fc22e55"}, + {file = "SQLAlchemy-1.4.9-cp27-cp27m-win_amd64.whl", hash = "sha256:e7d262415e4adf148441bd9f10ae4e5498d6649962fabc62a64ec7b4891d56c5"}, + {file = "SQLAlchemy-1.4.9-cp27-cp27mu-manylinux1_x86_64.whl", hash = "sha256:c6f228b79fd757d9ca539c9958190b3a44308f743dc7d83575aa0891033f6c86"}, + {file = "SQLAlchemy-1.4.9-cp36-cp36m-macosx_10_14_x86_64.whl", hash = "sha256:cfbf2cf8e8ef0a1d23bfd0fa387057e6e522d55e43821f1d115941d913ee7762"}, + {file = "SQLAlchemy-1.4.9-cp36-cp36m-manylinux1_x86_64.whl", hash = "sha256:815a8cdf9c0fa504d0bfbe83fb3e596b7663fc828b73259a20299c01330467aa"}, + {file = "SQLAlchemy-1.4.9-cp36-cp36m-manylinux2010_x86_64.whl", hash = "sha256:cfa4a336de7d32ae30b54f7b8ec888fb5c6313a1b7419a9d7b3f49cdd83012a3"}, + {file = "SQLAlchemy-1.4.9-cp36-cp36m-manylinux2014_aarch64.whl", hash = "sha256:065ac7331b87494a86bf3dc4430c1ee7779d6dc532213c528394ddd00804e518"}, + {file = "SQLAlchemy-1.4.9-cp36-cp36m-manylinux2014_x86_64.whl", hash = "sha256:690fbca2a208314504a2ab46d3e7dae320247fcb1967863b9782a70bf49fc600"}, + {file = "SQLAlchemy-1.4.9-cp36-cp36m-win32.whl", hash = "sha256:4edff2b4101a1c442fb1b17d594a5fdf99145f27c5eaffae12c26aef2bb2bf65"}, + {file = "SQLAlchemy-1.4.9-cp36-cp36m-win_amd64.whl", hash = "sha256:6c6090d73820dcf04549f0b6e80f67b46c8191f0e40bf09c6d6f8ece2464e8b6"}, + {file = "SQLAlchemy-1.4.9-cp37-cp37m-macosx_10_14_x86_64.whl", hash = "sha256:fc82688695eacf77befc3d839df2bc7ff314cd1d547f120835acdcbac1a480b8"}, + {file = "SQLAlchemy-1.4.9-cp37-cp37m-manylinux1_x86_64.whl", hash = "sha256:4e554872766d2783abf0a11704536596e8794229fb0fa63d311a74caae58c6c5"}, + {file = "SQLAlchemy-1.4.9-cp37-cp37m-manylinux2010_x86_64.whl", hash = "sha256:bce6eaf7b9a3a445911e225570b8fd26b7e98654ac9f308a8a52addb64a2a488"}, + {file = "SQLAlchemy-1.4.9-cp37-cp37m-manylinux2014_aarch64.whl", hash = "sha256:25aaf0bec9eadde9789e3c0178c718ae6923b57485fdeae85999bc3089d9b871"}, + {file = "SQLAlchemy-1.4.9-cp37-cp37m-manylinux2014_x86_64.whl", hash = "sha256:f239778cf03cd46da4962636501f6dea55af9b4684cd7ceee104ad4f0290e878"}, + {file = "SQLAlchemy-1.4.9-cp37-cp37m-win32.whl", hash = "sha256:b0266e133d819d33b555798822606e876187a96798e2d8c9b7f85e419d73ef94"}, + {file = "SQLAlchemy-1.4.9-cp37-cp37m-win_amd64.whl", hash = "sha256:230b210fc6d1af5d555d1d04ff9bd4259d6ab82b020369724ab4a1c805a32dd3"}, + {file = "SQLAlchemy-1.4.9-cp38-cp38-macosx_10_14_x86_64.whl", hash = "sha256:a28c7b96bc5beef585172ca9d79068ae7fa2527feaa26bd63371851d7894c66f"}, + {file = "SQLAlchemy-1.4.9-cp38-cp38-manylinux1_x86_64.whl", hash = "sha256:457a1652bc1c5f832165ff341380b3742bfb98b9ceca24576350992713ad700f"}, + {file = "SQLAlchemy-1.4.9-cp38-cp38-manylinux2010_x86_64.whl", hash = "sha256:e9e95568eafae18ac40d00694b82dc3febe653f81eee83204ef248563f39696d"}, + {file = "SQLAlchemy-1.4.9-cp38-cp38-manylinux2014_aarch64.whl", hash = "sha256:0d8aab144cf8d31c1ac834802c7df4430248f74bd8b3ed3149f9c9eec0eafe50"}, + {file = "SQLAlchemy-1.4.9-cp38-cp38-manylinux2014_x86_64.whl", hash = "sha256:cde2cf3ee76e8c538f2f43f5cf9252ad53404fc350801191128bab68f335a8b2"}, + {file = "SQLAlchemy-1.4.9-cp38-cp38-win32.whl", hash = "sha256:bb97aeaa699c43da62e35856ab56e5154d062c09a3593a2c12c67d6a21059920"}, + {file = "SQLAlchemy-1.4.9-cp38-cp38-win_amd64.whl", hash = "sha256:fbdcf9019e92253fc6aa0bcd5937302664c3a4d53884c425c0caa994e56c4421"}, + {file = "SQLAlchemy-1.4.9-cp39-cp39-macosx_10_14_x86_64.whl", hash = "sha256:2e1b8d31c97a2b91aea8ed8299ad360a32d60728a89f2aac9c98eef07a633a0e"}, + {file = "SQLAlchemy-1.4.9-cp39-cp39-manylinux1_x86_64.whl", hash = "sha256:7bdb0f972bc35054c05088e91cec8fa810c3aa565b690bae75c005ee430e12e8"}, + {file = "SQLAlchemy-1.4.9-cp39-cp39-manylinux2010_x86_64.whl", hash = "sha256:ec7c33e22beac16b4c5348c41cd94cfee056152e55a0efc62843deebfc53fcb4"}, + {file = "SQLAlchemy-1.4.9-cp39-cp39-manylinux2014_aarch64.whl", hash = "sha256:29816a338982c30dd7ee76c4e79f17d5991abb1b6561e9f1d72703d030a79c86"}, + {file = "SQLAlchemy-1.4.9-cp39-cp39-manylinux2014_x86_64.whl", hash = "sha256:099e63ffad329989080c533896267c40f9cb38ed5704168f7dae3afdda121e10"}, + {file = "SQLAlchemy-1.4.9-cp39-cp39-win32.whl", hash = "sha256:343c679899afdc4952ac659dc46f2075a2bd4fba87ca0df264be838eecd02096"}, + {file = "SQLAlchemy-1.4.9-cp39-cp39-win_amd64.whl", hash = "sha256:386f215248c3fb2fab9bb77f631bc3c6cd38354ca2363d241784f8297d16b80a"}, + {file = "SQLAlchemy-1.4.9.tar.gz", hash = "sha256:f31757972677fbe9132932a69a4f23db59187a072cc26427f56a3082b46b6dac"}, ] werkzeug = [ {file = "Werkzeug-1.0.1-py2.py3-none-any.whl", hash = "sha256:2de2a5db0baeae7b2d2664949077c2ac63fbd16d98da0ff71837f7d1dea3fd43"},