diff --git a/advlabdb/advlabdb_independent_funs.py b/advlabdb/advlabdb_independent_funs.py index bc16d3f..5a4b5de 100644 --- a/advlabdb/advlabdb_independent_funs.py +++ b/advlabdb/advlabdb_independent_funs.py @@ -1,6 +1,7 @@ # Functions not dependent on advlabdb from flask import flash +from markupsafe import Markup def flashRandomPassword(password): @@ -15,3 +16,11 @@ def parse_bool(str): return True else: raise ValueError(f'Can not parse a bool from "{str}"') + + +def missing_formatter(view, context, model, name): + attr = getattr(model, name) + if attr is None: + return Markup("MISSING") + + return attr