diff --git a/advlabdb/model_dependent_funs.py b/advlabdb/model_dependent_funs.py index ce913ca..7574928 100644 --- a/advlabdb/model_dependent_funs.py +++ b/advlabdb/model_dependent_funs.py @@ -31,10 +31,6 @@ def initActiveSemesterMenuLinks(space): space.add_link(MenuLink(name="Logout", url=url_for("security.logout"))) -def reportBadAttempt(message): - print("BAD ATTEMPT:", message) # TODO: Log - - def get_count(table): return db.session.scalar(select(func.count()).select_from(table)) @@ -48,9 +44,10 @@ def active_semester_str(): return active_semester_str -def mark_field(mark_type: str): +def mark_field(mark_type: str, default=None): return IntegerField( mark_type + " Mark", + default=default, validators=[Optional(), NumberRange(MIN_MARK, MAX_MARK)], description=f"Between {MIN_MARK} and {MAX_MARK}.", )