diff --git a/sqladmin/widgets.py b/sqladmin/widgets.py index 28f38b43..f1be146d 100644 --- a/sqladmin/widgets.py +++ b/sqladmin/widgets.py @@ -54,7 +54,10 @@ def __call__(self, field: Field, **kwargs: Any) -> Markup: kwargs["data-json"] = json.dumps(result) kwargs["multiple"] = "1" else: - data = field.loader.format(field.data) + try: + data = field.loader.format(field.data) + except Exception: + data = None if data: kwargs["data-json"] = json.dumps([data])