File tree Expand file tree Collapse file tree 1 file changed +11
-6
lines changed Expand file tree Collapse file tree 1 file changed +11
-6
lines changed Original file line number Diff line number Diff line change @@ -629,12 +629,17 @@ def _handle_model(
629
629
if isinstance (model , Object ):
630
630
obj_type = model .type
631
631
632
- try :
633
- sel_types , def_type = instances_mapping [obj_type ]
634
- except KeyError :
635
- raise TypeError (
636
- f"{ model .__class__ .__name__ } is not a valid instance for a select default value" ,
637
- )
632
+ sel_types = None
633
+ def_type = None
634
+
635
+ for typ , (st , dt ) in instances_mapping .items ():
636
+ if isinstance (model , typ ):
637
+ sel_types = st
638
+ def_type = dt
639
+ break
640
+
641
+ if sel_types is None or def_type is None :
642
+ raise TypeError (f"{ obj_type .__name__ } is not a valid instance for a select default value" )
638
643
639
644
# we can't actually check select types when not in a select context
640
645
if select_type is not None and select_type not in sel_types :
You can’t perform that action at this time.
0 commit comments