1
0
Fork 0
mirror of https://codeberg.org/Mo8it/AdvLabDB.git synced 2024-09-19 18:31:16 +00:00

Further deduplication

This commit is contained in:
Mo 2022-06-17 19:58:43 +02:00
parent 2790652475
commit 4c64a8cefd

View file

@ -1135,6 +1135,14 @@ class AppointmentView(SecureAdminModelView):
)
def mark_field(mark_type: str):
return IntegerField(
mark_type + " Mark",
validators=[Optional(), NumberRange(MIN_MARK, MAX_MARK)],
description=f"Between {MIN_MARK} and {MAX_MARK}.",
)
class ExperimentMarkView(SecureAdminModelView):
class StudentFilter(FilterEqual):
def validate(self, value):
@ -1215,16 +1223,8 @@ class ExperimentMarkView(SecureAdminModelView):
)
class EditForm(Form):
oral_mark = IntegerField(
"Oral Mark",
validators=[Optional(), NumberRange(MIN_MARK, MAX_MARK)],
description=f"Between {MIN_MARK} and {MAX_MARK}.",
)
protocol_mark = IntegerField(
"Protocol Mark",
validators=[Optional(), NumberRange(MIN_MARK, MAX_MARK)],
description=f"Between {MIN_MARK} and {MAX_MARK}.",
)
oral_mark = mark_field("Oral")
protocol_mark = mark_field("Protocol")
column_descriptions = {
"oral_mark": f"Between {MIN_MARK} and {MAX_MARK}",