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

Use jinja.html

This commit is contained in:
Mo 2022-09-11 14:55:53 +02:00
parent 9bc1a334be
commit 6edb47fed9
23 changed files with 45 additions and 44 deletions

View file

@ -136,6 +136,14 @@ class UserView(SecureAdminModelView):
def default_roles():
return [user_datastore.find_role("assistant")]
active_semester = QuerySelectField(
"Active Semester",
query_factory=semesterQueryFactory,
validators=[DataRequired()],
default=Semester.lastSemester,
description="Not fixed and users (including assistants) can change it.",
)
email = StringField(
"Email",
validators=[DataRequired(), Email()],
@ -170,13 +178,6 @@ class UserView(SecureAdminModelView):
"Active",
default=True,
)
active_semester = QuerySelectField(
"Active Semester",
query_factory=semesterQueryFactory,
validators=[DataRequired()],
default=Semester.lastSemester,
description="Not fixed and users (including assistants) can change it.",
)
class EditForm(CreateForm):
semester_experiments = None
@ -1298,7 +1299,7 @@ class ImportView(SecureAdminBaseView):
except Exception as ex:
flash(str(ex), "error")
return self.render("import.html", form=form)
return self.render("import.jinja.html", form=form)
class ActionsView(SecureAdminBaseView):
@ -1320,7 +1321,7 @@ class ActionsView(SecureAdminBaseView):
return redirect(url_for("main.index"))
return self.render("actions.html", form=form)
return self.render("actions.jinja.html", form=form)
class AnalysisView(SecureAdminBaseView):
@ -1420,7 +1421,7 @@ class AnalysisView(SecureAdminBaseView):
protocolMarkHists = AnalysisView.markHists("Protocol", activeAssistants)
return self.render(
"analysis/assistant_marks.html",
"analysis/assistant_marks.jinja.html",
histIndices=range(len(oralMarkHists)),
oralMarkHists=oralMarkHists,
protocolMarkHists=protocolMarkHists,
@ -1469,18 +1470,18 @@ class AnalysisView(SecureAdminBaseView):
meanFinalPartMarksPlot = AnalysisView.htmlFig(fig)
return self.render(
"analysis/final_part_marks.html",
"analysis/final_part_marks.jinja.html",
activeSemesterFinalPartMarksHists=activeSemesterFinalPartMarksHists,
meanFinalPartMarksPlot=meanFinalPartMarksPlot,
)
return self.render("analysis/analysis.html", form=form)
return self.render("analysis/analysis.jinja.html", form=form)
class DocsView(SecureAdminBaseView):
@expose("/")
def index(self):
return self.render("docs/docs.html", role="admin")
return self.render("docs/docs.jinja.html", role="admin")
def init_admin_model_views(app):

View file

@ -168,7 +168,7 @@ class AssistantGroupExperimentView(SecureAssistantModelView):
final_experiment_marks = [experiment_mark.final_experiment_mark for experiment_mark in experiment_marks]
return self.render(
"assistant_group_experiment_form.html",
"assistant_group_experiment_form.jinja.html",
form=form,
experiment_label=group_experiment.semester_experiment.experiment.str(),
group_number=group_experiment.group.number,
@ -220,7 +220,7 @@ class AssistantUserView(SecureAssistantModelView):
class AssistantDocsView(SecureAssistantBaseView):
@expose("/")
def index(self):
return self.render("docs/docs.html", role="assistant")
return self.render("docs/docs.jinja.html", role="assistant")
def init_assistant_model_views(app):

View file

@ -61,7 +61,7 @@ class SecureAdminIndexView(CustomIndexView):
)
return self.render(
"admin_index.html",
"admin_index.jinja.html",
number_of_missing_final_experiment_marks=number_of_missing_final_experiment_marks,
number_of_all_experiment_marks=number_of_all_experiment_marks,
)
@ -89,7 +89,7 @@ class SecureAssistantIndexView(CustomIndexView):
)
return self.render(
"assistant_index.html",
"assistant_index.jinja.html",
number_of_missing_final_experiment_marks=number_of_missing_final_experiment_marks,
number_of_all_experiment_marks=number_of_all_experiment_marks,
)
@ -230,10 +230,10 @@ class SecureAdminModelView(CustomModelView):
column_display_actions = True
can_view_details = True
list_template = "admin_list.html"
create_template = "admin_create.html"
edit_template = "admin_edit.html"
details_template = "admin_details.html"
list_template = "admin_list.jinja.html"
create_template = "admin_create.jinja.html"
edit_template = "admin_edit.jinja.html"
details_template = "admin_details.jinja.html"
def __init__(self, model, **kwargs):
url = get_url(kwargs)
@ -250,10 +250,10 @@ class SecureAssistantModelView(CustomModelView):
can_edit = False
column_display_actions = False
list_template = "assistant_list.html"
create_template = "assistant_create.html"
edit_template = "assistant_edit.html"
details_template = "assistant_details.html"
list_template = "assistant_list.jinja.html"
create_template = "assistant_create.jinja.html"
edit_template = "assistant_edit.jinja.html"
details_template = "assistant_details.jinja.html"
"""
SECURITY NOTES:

View file

@ -1,4 +1,4 @@
{% from "macros.html" import information %}
{% from "macros.jinja.html" import information %}
{% extends "admin/master.html" %}
{% block body %}

View file

@ -1,4 +1,4 @@
{% from "macros.html" import information %}
{% from "macros.jinja.html" import information %}
{% extends "admin/model/create.html" %}
{% block body %}

View file

@ -1,4 +1,4 @@
{% from "macros.html" import information %}
{% from "macros.jinja.html" import information %}
{% extends "admin/model/details.html" %}
{% block body %}

View file

@ -1,4 +1,4 @@
{% from "macros.html" import information %}
{% from "macros.jinja.html" import information %}
{% extends "admin/model/edit.html" %}
{% block body %}

View file

@ -1,4 +1,4 @@
{% from "macros.html" import information, missing_final_experiment_marks %}
{% from "macros.jinja.html" import information, missing_final_experiment_marks %}
{% extends "admin/index.html" %}
{% block body %}

View file

@ -1,4 +1,4 @@
{% from "macros.html" import information %}
{% from "macros.jinja.html" import information %}
{% extends "admin/model/list.html" %}
{% block body %}

View file

@ -1,4 +1,4 @@
{% from "macros.html" import information %}
{% from "macros.jinja.html" import information %}
{% extends "admin/master.html" %}
{% block body %}

View file

@ -1,4 +1,4 @@
{% from "macros.html" import information %}
{% from "macros.jinja.html" import information %}
{% extends "admin/master.html" %}
{% block body %}

View file

@ -1,4 +1,4 @@
{% from "macros.html" import information %}
{% from "macros.jinja.html" import information %}
{% extends "admin/master.html" %}
{% block body %}

View file

@ -1,4 +1,4 @@
{% from "macros.html" import information %}
{% from "macros.jinja.html" import information %}
{% extends "admin/model/create.html" %}
{% block body %}

View file

@ -1,4 +1,4 @@
{% from "macros.html" import information %}
{% from "macros.jinja.html" import information %}
{% extends "admin/model/details.html" %}
{% block body %}

View file

@ -1,4 +1,4 @@
{% from "macros.html" import information %}
{% from "macros.jinja.html" import information %}
{% extends "admin/model/edit.html" %}
{% block body %}

View file

@ -1,4 +1,4 @@
{% from "macros.html" import information %}
{% from "macros.jinja.html" import information %}
{% extends "admin/master.html" %}
{% block body %}

View file

@ -1,4 +1,4 @@
{% from "macros.html" import information, missing_final_experiment_marks %}
{% from "macros.jinja.html" import information, missing_final_experiment_marks %}
{% extends "admin/index.html" %}
{% block body %}

View file

@ -1,4 +1,4 @@
{% from "macros.html" import information %}
{% from "macros.jinja.html" import information %}
{% extends "admin/model/list.html" %}
{% block body %}

View file

@ -1,4 +1,4 @@
{% from "macros.html" import information %}
{% from "macros.jinja.html" import information %}
{% extends "admin/master.html" %}
{% block body %}
@ -6,7 +6,7 @@
<hr>
{% include "docs/" + role + ".html" %}
{% include "docs/" + role + ".jinja.html" %}
{{ footer|safe }}
{% endblock body %}

View file

@ -1,4 +1,4 @@
{% from "macros.html" import information %}
{% from "macros.jinja.html" import information %}
{% extends "admin/master.html" %}
{% block body %}

View file

@ -1,6 +1,6 @@
{% macro information(current_user, active_semester_str, role) %} User:
<a
href="{{ url_for('main.index') }}{{ role }}/user/details/?id={{ current_user.id }}"
href="{{ url_for('main.index') }}{{ role }}/user/edit/?id={{ current_user.id }}"
>{{ current_user }}</a
>