Skip to content

Commit

Permalink
a head-on decision to fix bug when ajax form loading after error in i…
Browse files Browse the repository at this point in the history
…nsert model
  • Loading branch information
Николай Зарочинцев authored and aminalaee committed Sep 5, 2024
1 parent 3b1a355 commit d0f3d01
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 d0f3d01

Please sign in to comment.