mirror of
https://codeberg.org/Mo8it/AdvLabDB.git
synced 2025-04-10 20:48:36 +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,
|
||||
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 .database_import import importFromFile
|
||||
from .exceptions import DataBaseException, ModelViewException
|
||||
|
@ -940,11 +944,14 @@ class GroupExperimentView(SecureAdminModelView):
|
|||
)
|
||||
refreshFiltersCache = True
|
||||
|
||||
column_default_sort = ("experiment_marks_missing", True)
|
||||
|
||||
column_formatters = {
|
||||
"semester_experiment": semester_experiment_formatter,
|
||||
"group": group_formatter,
|
||||
"appointments": appointment_date_formatter,
|
||||
"experiment_marks": experiment_mark_formatter,
|
||||
"experiment_marks_missing": experiment_marks_missing_formatter,
|
||||
}
|
||||
|
||||
def query_modifier(self, query):
|
||||
|
|
|
@ -90,3 +90,11 @@ def email_formatter(view, context, model, name):
|
|||
return ""
|
||||
|
||||
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 .advlabdb_independent_funs import (
|
||||
deep_getattr,
|
||||
experiment_marks_missing_formatter,
|
||||
flashRandomPassword,
|
||||
missing_formatter,
|
||||
str_formatter,
|
||||
|
@ -79,13 +80,6 @@ class AssistantGroupExperimentView(SecureAssistantModelView):
|
|||
|
||||
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 = {
|
||||
"semester_experiment.experiment": str_formatter,
|
||||
"group.part_students": part_students_formatter,
|
||||
|
|
Loading…
Add table
Reference in a new issue