1
0
Fork 0
mirror of https://codeberg.org/Mo8it/AdvLabDB.git synced 2024-11-08 21:21:06 +00:00

Replace _repr with _str

This commit is contained in:
Mo 2022-06-01 22:53:23 +02:00
parent 400ba8f379
commit f45b3fbc4d
19 changed files with 25 additions and 25 deletions

View file

@ -37,10 +37,10 @@ def get_count(table):
return db.session.scalar(select(func.count()).select_from(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 active_semester = current_user.active_semester
repr = active_semester.repr() active_semester_str = str(active_semester)
if active_semester != Semester.lastSemester(): 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

View file

@ -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 flask_security import auth_required, current_user, roles_accepted, roles_required
from . import app, db from . import app, db
from .model_dependent_funs import active_semester_repr from .model_dependent_funs import active_semester_str
from .models import Semester from .models import Semester
@ -10,7 +10,7 @@ from .models import Semester
def util_processor(): def util_processor():
author_email = "mo8it@proton.me" author_email = "mo8it@proton.me"
footer = f"<hr><p style='font-size:14px'>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: <a href='mailto:{author_email}'>{author_email}</a>. Feedback is also welcome :)</p><br>" footer = f"<hr><p style='font-size:14px'>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: <a href='mailto:{author_email}'>{author_email}</a>. Feedback is also welcome :)</p><br>"
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("/") @app.route("/")

View file

@ -2,7 +2,7 @@
{% extends "admin/master.html" %} {% extends "admin/master.html" %}
{% block body %} {% block body %}
{{ information(current_user, active_semester_repr, role="admin") }} {{ information(current_user, active_semester_str, role="admin") }}
<hr> <hr>

View file

@ -2,7 +2,7 @@
{% extends "admin/model/create.html" %} {% extends "admin/model/create.html" %}
{% block body %} {% block body %}
{{ information(current_user, active_semester_repr, role="admin") }} {{ information(current_user, active_semester_str, role="admin") }}
{{ super() }} {{ super() }}

View file

@ -2,7 +2,7 @@
{% extends "admin/model/details.html" %} {% extends "admin/model/details.html" %}
{% block body %} {% block body %}
{{ information(current_user, active_semester_repr, role="admin") }} {{ information(current_user, active_semester_str, role="admin") }}
{{ super() }} {{ super() }}

View file

@ -2,7 +2,7 @@
{% extends "admin/model/edit.html" %} {% extends "admin/model/edit.html" %}
{% block body %} {% block body %}
{{ information(current_user, active_semester_repr, role="admin") }} {{ information(current_user, active_semester_str, role="admin") }}
{{ super() }} {{ super() }}

View file

@ -2,7 +2,7 @@
{% extends "admin/index.html" %} {% extends "admin/index.html" %}
{% block body %} {% block body %}
{{ information(current_user, active_semester_repr, role="admin") }} {{ information(current_user, active_semester_str, role="admin") }}
<hr> <hr>

View file

@ -2,7 +2,7 @@
{% extends "admin/model/list.html" %} {% extends "admin/model/list.html" %}
{% block body %} {% block body %}
{{ information(current_user, active_semester_repr, role="admin") }} {{ information(current_user, active_semester_str, role="admin") }}
{{ super() }} {{ super() }}

View file

@ -2,7 +2,7 @@
{% extends "admin/master.html" %} {% extends "admin/master.html" %}
{% block body %} {% block body %}
{{information(current_user, active_semester_repr, role="admin")}} {{information(current_user, active_semester_str, role="admin")}}
<hr> <hr>

View file

@ -2,7 +2,7 @@
{% extends "admin/master.html" %} {% extends "admin/master.html" %}
{% block body %} {% block body %}
{{information(current_user, active_semester_repr, role="admin")}} {{information(current_user, active_semester_str, role="admin")}}
<hr> <hr>

View file

@ -2,7 +2,7 @@
{% extends "admin/master.html" %} {% extends "admin/master.html" %}
{% block body %} {% block body %}
{{information(current_user, active_semester_repr, role="admin")}} {{information(current_user, active_semester_str, role="admin")}}
<hr> <hr>

View file

@ -2,7 +2,7 @@
{% extends "admin/model/create.html" %} {% extends "admin/model/create.html" %}
{% block body %} {% block body %}
{{ information(current_user, active_semester_repr, role="assistant") }} {{ information(current_user, active_semester_str, role="assistant") }}
{{ super() }} {{ super() }}

View file

@ -2,7 +2,7 @@
{% extends "admin/model/details.html" %} {% extends "admin/model/details.html" %}
{% block body %} {% block body %}
{{ information(current_user, active_semester_repr, role="assistant") }} {{ information(current_user, active_semester_str, role="assistant") }}
{{ super() }} {{ super() }}

View file

@ -2,7 +2,7 @@
{% extends "admin/model/edit.html" %} {% extends "admin/model/edit.html" %}
{% block body %} {% block body %}
{{ information(current_user, active_semester_repr, role="assistant") }} {{ information(current_user, active_semester_str, role="assistant") }}
{{ super() }} {{ super() }}

View file

@ -2,7 +2,7 @@
{% extends "admin/index.html" %} {% extends "admin/index.html" %}
{% block body %} {% block body %}
{{ information(current_user, active_semester_repr, role="assistant") }} {{ information(current_user, active_semester_str, role="assistant") }}
<hr> <hr>

View file

@ -2,7 +2,7 @@
{% extends "admin/model/list.html" %} {% extends "admin/model/list.html" %}
{% block body %} {% block body %}
{{ information(current_user, active_semester_repr, role="assistant") }} {{ information(current_user, active_semester_str, role="assistant") }}
{{ super() }} {{ super() }}

View file

@ -2,7 +2,7 @@
{% extends "admin/master.html" %} {% extends "admin/master.html" %}
{% block body %} {% block body %}
{{ information(current_user, active_semester_repr, role=role) }} {{ information(current_user, active_semester_str, role=role) }}
<hr> <hr>

View file

@ -2,7 +2,7 @@
{% extends "admin/master.html" %} {% extends "admin/master.html" %}
{% block body %} {% block body %}
{{ information(current_user, active_semester_repr, role="admin") }} {{ information(current_user, active_semester_str, role="admin") }}
<hr> <hr>

View file

@ -1,7 +1,7 @@
{% macro information(current_user, active_semester_repr, role) %} {% macro information(current_user, active_semester_str, role) %}
User: <a href="{{ url_for('index') }}{{ role }}/user/details/?id={{ current_user.id }}">{{ current_user.repr() }}</a> User: <a href="{{ url_for('index') }}{{ role }}/user/details/?id={{ current_user.id }}">{{ current_user }}</a>
| Active semester: {{ active_semester_repr() }} | Active semester: {{ active_semester_str() }}
{% if (role == "admin") and (current_user.has_role("assistant")) %} {% if (role == "admin") and (current_user.has_role("assistant")) %}
| <a href="{{ url_for('index') }}assistant">Assistant space</a>. | <a href="{{ url_for('index') }}assistant">Assistant space</a>.