mirror of
https://codeberg.org/Mo8it/AdvLabDB.git
synced 2024-09-19 18:31:16 +00:00
Add experiment_marks_missing_formatter to admin space
This commit is contained in:
parent
4d9a72431d
commit
6f428aa3a9
3 changed files with 17 additions and 8 deletions
|
@ -49,7 +49,11 @@ from .admin_link_formatters import (
|
||||||
student_formatter,
|
student_formatter,
|
||||||
user_formatter,
|
user_formatter,
|
||||||
)
|
)
|
||||||
from .advlabdb_independent_funs import email_formatter, flashRandomPassword
|
from .advlabdb_independent_funs import (
|
||||||
|
email_formatter,
|
||||||
|
experiment_marks_missing_formatter,
|
||||||
|
flashRandomPassword,
|
||||||
|
)
|
||||||
from .customClasses import SecureAdminBaseView, SecureAdminModelView
|
from .customClasses import SecureAdminBaseView, SecureAdminModelView
|
||||||
from .database_import import importFromFile
|
from .database_import import importFromFile
|
||||||
from .exceptions import DataBaseException, ModelViewException
|
from .exceptions import DataBaseException, ModelViewException
|
||||||
|
@ -940,11 +944,14 @@ class GroupExperimentView(SecureAdminModelView):
|
||||||
)
|
)
|
||||||
refreshFiltersCache = True
|
refreshFiltersCache = True
|
||||||
|
|
||||||
|
column_default_sort = ("experiment_marks_missing", True)
|
||||||
|
|
||||||
column_formatters = {
|
column_formatters = {
|
||||||
"semester_experiment": semester_experiment_formatter,
|
"semester_experiment": semester_experiment_formatter,
|
||||||
"group": group_formatter,
|
"group": group_formatter,
|
||||||
"appointments": appointment_date_formatter,
|
"appointments": appointment_date_formatter,
|
||||||
"experiment_marks": experiment_mark_formatter,
|
"experiment_marks": experiment_mark_formatter,
|
||||||
|
"experiment_marks_missing": experiment_marks_missing_formatter,
|
||||||
}
|
}
|
||||||
|
|
||||||
def query_modifier(self, query):
|
def query_modifier(self, query):
|
||||||
|
|
|
@ -90,3 +90,11 @@ def email_formatter(view, context, model, name):
|
||||||
return ""
|
return ""
|
||||||
|
|
||||||
return Markup(f"<a href='mailto:{escape(attr)}'>{escape(attr)}</a>")
|
return Markup(f"<a href='mailto:{escape(attr)}'>{escape(attr)}</a>")
|
||||||
|
|
||||||
|
|
||||||
|
def experiment_marks_missing_formatter(view, context, model, name):
|
||||||
|
experiment_marks_missing = getattr(model, name)
|
||||||
|
if experiment_marks_missing is True:
|
||||||
|
return Markup("<span style='color: red;'>Yes</span>")
|
||||||
|
|
||||||
|
return "No"
|
||||||
|
|
|
@ -10,6 +10,7 @@ from wtforms.validators import Optional
|
||||||
from . import assistantSpace, db
|
from . import assistantSpace, db
|
||||||
from .advlabdb_independent_funs import (
|
from .advlabdb_independent_funs import (
|
||||||
deep_getattr,
|
deep_getattr,
|
||||||
|
experiment_marks_missing_formatter,
|
||||||
flashRandomPassword,
|
flashRandomPassword,
|
||||||
missing_formatter,
|
missing_formatter,
|
||||||
str_formatter,
|
str_formatter,
|
||||||
|
@ -79,13 +80,6 @@ class AssistantGroupExperimentView(SecureAssistantModelView):
|
||||||
|
|
||||||
return ""
|
return ""
|
||||||
|
|
||||||
def experiment_marks_missing_formatter(view, context, model, name):
|
|
||||||
experiment_marks_missing = getattr(model, name)
|
|
||||||
if experiment_marks_missing is True:
|
|
||||||
return Markup("<span style='color: red;'>Yes</span>")
|
|
||||||
|
|
||||||
return "No"
|
|
||||||
|
|
||||||
column_formatters = {
|
column_formatters = {
|
||||||
"semester_experiment.experiment": str_formatter,
|
"semester_experiment.experiment": str_formatter,
|
||||||
"group.part_students": part_students_formatter,
|
"group.part_students": part_students_formatter,
|
||||||
|
|
Loading…
Reference in a new issue