1
0
Fork 0
mirror of https://codeberg.org/Mo8it/AdvLabDB.git synced 2024-12-20 23:41:20 +00:00

Add get_count

This commit is contained in:
Mo 2022-05-16 21:48:04 +02:00
parent 0c5709d2ab
commit eba6122aef

View file

@ -1,7 +1,7 @@
from flask import flash, url_for from flask import flash, url_for
from flask_admin.menu import MenuLink from flask_admin.menu import MenuLink
from flask_security import current_user from flask_security import current_user
from sqlalchemy import select from sqlalchemy import func, select
from . import app, db from . import app, db
from .models import Semester from .models import Semester
@ -83,3 +83,7 @@ def initActiveSemesterMenuLinks(space):
def reportBadAttempt(message): def reportBadAttempt(message):
print("BAD ATTEMPT:", message) # TODO: Log print("BAD ATTEMPT:", message) # TODO: Log
def get_count(table):
return db.session.scalar(select(func.count()).select_from(table))