mirror of
https://codeberg.org/Mo8it/AdvLabDB.git
synced 2024-11-08 21:21:06 +00:00
Add default to mark_field
This commit is contained in:
parent
787504c7a1
commit
a04472cd76
1 changed files with 2 additions and 5 deletions
|
@ -31,10 +31,6 @@ def initActiveSemesterMenuLinks(space):
|
||||||
space.add_link(MenuLink(name="Logout", url=url_for("security.logout")))
|
space.add_link(MenuLink(name="Logout", url=url_for("security.logout")))
|
||||||
|
|
||||||
|
|
||||||
def reportBadAttempt(message):
|
|
||||||
print("BAD ATTEMPT:", message) # TODO: Log
|
|
||||||
|
|
||||||
|
|
||||||
def get_count(table):
|
def get_count(table):
|
||||||
return db.session.scalar(select(func.count()).select_from(table))
|
return db.session.scalar(select(func.count()).select_from(table))
|
||||||
|
|
||||||
|
@ -48,9 +44,10 @@ def active_semester_str():
|
||||||
return active_semester_str
|
return active_semester_str
|
||||||
|
|
||||||
|
|
||||||
def mark_field(mark_type: str):
|
def mark_field(mark_type: str, default=None):
|
||||||
return IntegerField(
|
return IntegerField(
|
||||||
mark_type + " Mark",
|
mark_type + " Mark",
|
||||||
|
default=default,
|
||||||
validators=[Optional(), NumberRange(MIN_MARK, MAX_MARK)],
|
validators=[Optional(), NumberRange(MIN_MARK, MAX_MARK)],
|
||||||
description=f"Between {MIN_MARK} and {MAX_MARK}.",
|
description=f"Between {MIN_MARK} and {MAX_MARK}.",
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in a new issue