Skip to content

Commit

Permalink
fix: unhandled exception during AjaxSelect load (#727)
Browse files Browse the repository at this point in the history
  • Loading branch information
diskream authored Sep 5, 2024
1 parent 3b1a355 commit e1c7ae1
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion sqladmin/widgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -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])

Expand Down

0 comments on commit e1c7ae1

Please sign in to comment.