1
0
Fork 0
mirror of https://codeberg.org/Mo8it/AdvLabDB.git synced 2024-12-30 17:43:56 +00:00

Add default to mark_field

This commit is contained in:
Mo 2022-06-20 03:07:46 +02:00
parent 787504c7a1
commit a04472cd76

View file

@ -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}.",
)