diff --git a/advlabdb/model_dependent_funs.py b/advlabdb/model_dependent_funs.py index 790049f..a49e65d 100644 --- a/advlabdb/model_dependent_funs.py +++ b/advlabdb/model_dependent_funs.py @@ -37,10 +37,10 @@ def get_count(table): return db.session.scalar(select(func.count()).select_from(table)) -def active_semester_repr(): +def active_semester_str(): active_semester = current_user.active_semester - repr = active_semester.repr() + active_semester_str = str(active_semester) if active_semester != Semester.lastSemester(): - flash(f"You are in the old semester {repr}!", "warning") + flash(f"You are in the old semester {active_semester_str}!", "warning") - return repr + return active_semester_str diff --git a/advlabdb/routes.py b/advlabdb/routes.py index 0762a64..c6e5001 100644 --- a/advlabdb/routes.py +++ b/advlabdb/routes.py @@ -2,7 +2,7 @@ from flask import flash, redirect, render_template, request, url_for from flask_security import auth_required, current_user, roles_accepted, roles_required from . import app, db -from .model_dependent_funs import active_semester_repr +from .model_dependent_funs import active_semester_str from .models import Semester @@ -10,7 +10,7 @@ from .models import Semester def util_processor(): author_email = "mo8it@proton.me" footer = f"

This website is still under development (beta release)! If you have any questions, find any bugs or want some feature, please write a formless email to Mo Bitar: {author_email}. Feedback is also welcome :)


" - return dict(active_semester_repr=active_semester_repr, current_user=current_user, footer=footer) + return dict(active_semester_str=active_semester_str, current_user=current_user, footer=footer) @app.route("/") diff --git a/advlabdb/templates/actions.html b/advlabdb/templates/actions.html index 5d8da97..99cdc57 100644 --- a/advlabdb/templates/actions.html +++ b/advlabdb/templates/actions.html @@ -2,7 +2,7 @@ {% extends "admin/master.html" %} {% block body %} - {{ information(current_user, active_semester_repr, role="admin") }} + {{ information(current_user, active_semester_str, role="admin") }}
diff --git a/advlabdb/templates/admin_create.html b/advlabdb/templates/admin_create.html index 5fc796c..18442ae 100644 --- a/advlabdb/templates/admin_create.html +++ b/advlabdb/templates/admin_create.html @@ -2,7 +2,7 @@ {% extends "admin/model/create.html" %} {% block body %} - {{ information(current_user, active_semester_repr, role="admin") }} + {{ information(current_user, active_semester_str, role="admin") }} {{ super() }} diff --git a/advlabdb/templates/admin_details.html b/advlabdb/templates/admin_details.html index e8b3272..e67dce2 100644 --- a/advlabdb/templates/admin_details.html +++ b/advlabdb/templates/admin_details.html @@ -2,7 +2,7 @@ {% extends "admin/model/details.html" %} {% block body %} - {{ information(current_user, active_semester_repr, role="admin") }} + {{ information(current_user, active_semester_str, role="admin") }} {{ super() }} diff --git a/advlabdb/templates/admin_edit.html b/advlabdb/templates/admin_edit.html index 46f3015..8441e91 100644 --- a/advlabdb/templates/admin_edit.html +++ b/advlabdb/templates/admin_edit.html @@ -2,7 +2,7 @@ {% extends "admin/model/edit.html" %} {% block body %} - {{ information(current_user, active_semester_repr, role="admin") }} + {{ information(current_user, active_semester_str, role="admin") }} {{ super() }} diff --git a/advlabdb/templates/admin_index.html b/advlabdb/templates/admin_index.html index 71c25c1..53d5c71 100644 --- a/advlabdb/templates/admin_index.html +++ b/advlabdb/templates/admin_index.html @@ -2,7 +2,7 @@ {% extends "admin/index.html" %} {% block body %} - {{ information(current_user, active_semester_repr, role="admin") }} + {{ information(current_user, active_semester_str, role="admin") }}
diff --git a/advlabdb/templates/admin_list.html b/advlabdb/templates/admin_list.html index 14c6fa2..cc6a8c9 100644 --- a/advlabdb/templates/admin_list.html +++ b/advlabdb/templates/admin_list.html @@ -2,7 +2,7 @@ {% extends "admin/model/list.html" %} {% block body %} - {{ information(current_user, active_semester_repr, role="admin") }} + {{ information(current_user, active_semester_str, role="admin") }} {{ super() }} diff --git a/advlabdb/templates/analysis/analysis.html b/advlabdb/templates/analysis/analysis.html index bf4d8a5..f470bf8 100644 --- a/advlabdb/templates/analysis/analysis.html +++ b/advlabdb/templates/analysis/analysis.html @@ -2,7 +2,7 @@ {% extends "admin/master.html" %} {% block body %} - {{information(current_user, active_semester_repr, role="admin")}} + {{information(current_user, active_semester_str, role="admin")}}
diff --git a/advlabdb/templates/analysis/assistant_marks.html b/advlabdb/templates/analysis/assistant_marks.html index a057857..0ef343b 100644 --- a/advlabdb/templates/analysis/assistant_marks.html +++ b/advlabdb/templates/analysis/assistant_marks.html @@ -2,7 +2,7 @@ {% extends "admin/master.html" %} {% block body %} - {{information(current_user, active_semester_repr, role="admin")}} + {{information(current_user, active_semester_str, role="admin")}}
diff --git a/advlabdb/templates/analysis/final_part_marks.html b/advlabdb/templates/analysis/final_part_marks.html index 6136bbc..348cf47 100644 --- a/advlabdb/templates/analysis/final_part_marks.html +++ b/advlabdb/templates/analysis/final_part_marks.html @@ -2,7 +2,7 @@ {% extends "admin/master.html" %} {% block body %} - {{information(current_user, active_semester_repr, role="admin")}} + {{information(current_user, active_semester_str, role="admin")}}
diff --git a/advlabdb/templates/assistant_create.html b/advlabdb/templates/assistant_create.html index e6a7cd7..c29c5af 100644 --- a/advlabdb/templates/assistant_create.html +++ b/advlabdb/templates/assistant_create.html @@ -2,7 +2,7 @@ {% extends "admin/model/create.html" %} {% block body %} - {{ information(current_user, active_semester_repr, role="assistant") }} + {{ information(current_user, active_semester_str, role="assistant") }} {{ super() }} diff --git a/advlabdb/templates/assistant_details.html b/advlabdb/templates/assistant_details.html index 1d90ede..0b54651 100644 --- a/advlabdb/templates/assistant_details.html +++ b/advlabdb/templates/assistant_details.html @@ -2,7 +2,7 @@ {% extends "admin/model/details.html" %} {% block body %} - {{ information(current_user, active_semester_repr, role="assistant") }} + {{ information(current_user, active_semester_str, role="assistant") }} {{ super() }} diff --git a/advlabdb/templates/assistant_edit.html b/advlabdb/templates/assistant_edit.html index 655c843..123ba00 100644 --- a/advlabdb/templates/assistant_edit.html +++ b/advlabdb/templates/assistant_edit.html @@ -2,7 +2,7 @@ {% extends "admin/model/edit.html" %} {% block body %} - {{ information(current_user, active_semester_repr, role="assistant") }} + {{ information(current_user, active_semester_str, role="assistant") }} {{ super() }} diff --git a/advlabdb/templates/assistant_index.html b/advlabdb/templates/assistant_index.html index 32649bc..ec7960d 100644 --- a/advlabdb/templates/assistant_index.html +++ b/advlabdb/templates/assistant_index.html @@ -2,7 +2,7 @@ {% extends "admin/index.html" %} {% block body %} - {{ information(current_user, active_semester_repr, role="assistant") }} + {{ information(current_user, active_semester_str, role="assistant") }}
diff --git a/advlabdb/templates/assistant_list.html b/advlabdb/templates/assistant_list.html index c557120..397328a 100644 --- a/advlabdb/templates/assistant_list.html +++ b/advlabdb/templates/assistant_list.html @@ -2,7 +2,7 @@ {% extends "admin/model/list.html" %} {% block body %} - {{ information(current_user, active_semester_repr, role="assistant") }} + {{ information(current_user, active_semester_str, role="assistant") }} {{ super() }} diff --git a/advlabdb/templates/docs/docs.html b/advlabdb/templates/docs/docs.html index 810e016..7246e0d 100644 --- a/advlabdb/templates/docs/docs.html +++ b/advlabdb/templates/docs/docs.html @@ -2,7 +2,7 @@ {% extends "admin/master.html" %} {% block body %} - {{ information(current_user, active_semester_repr, role=role) }} + {{ information(current_user, active_semester_str, role=role) }}
diff --git a/advlabdb/templates/import.html b/advlabdb/templates/import.html index bf48787..b1703b7 100644 --- a/advlabdb/templates/import.html +++ b/advlabdb/templates/import.html @@ -2,7 +2,7 @@ {% extends "admin/master.html" %} {% block body %} - {{ information(current_user, active_semester_repr, role="admin") }} + {{ information(current_user, active_semester_str, role="admin") }}
diff --git a/advlabdb/templates/macros.html b/advlabdb/templates/macros.html index cdd8df2..e4262af 100644 --- a/advlabdb/templates/macros.html +++ b/advlabdb/templates/macros.html @@ -1,7 +1,7 @@ -{% macro information(current_user, active_semester_repr, role) %} - User: {{ current_user.repr() }} +{% macro information(current_user, active_semester_str, role) %} + User: {{ current_user }} - | Active semester: {{ active_semester_repr() }} + | Active semester: {{ active_semester_str() }} {% if (role == "admin") and (current_user.has_role("assistant")) %} | Assistant space.