1
0
Fork 0
mirror of https://codeberg.org/Mo8it/AdvLabDB.git synced 2024-09-19 18:31:16 +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))
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

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 . 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"<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("/")

View file

@ -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") }}
<hr>

View file

@ -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() }}

View file

@ -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() }}

View file

@ -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() }}

View file

@ -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") }}
<hr>

View file

@ -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() }}

View file

@ -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")}}
<hr>

View file

@ -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")}}
<hr>

View file

@ -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")}}
<hr>

View file

@ -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() }}

View file

@ -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() }}

View file

@ -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() }}

View file

@ -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") }}
<hr>

View file

@ -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() }}

View file

@ -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) }}
<hr>

View file

@ -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") }}
<hr>

View file

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