File tree Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -388,7 +388,15 @@ def __init__(
388388 init_kwargs : dict [str , Any ],
389389 nested_model_default_partial_update : bool | None = None ,
390390 ):
391- self .init_kwargs = init_kwargs
391+ self .init_kwargs = {}
392+ init_kwargs_names = set (init_kwargs .keys ())
393+ for field_name , field_info in settings_cls .model_fields .items ():
394+ alias_names , * _ = _get_alias_names (field_name , field_info )
395+ init_kwarg_name = init_kwargs_names & set (alias_names )
396+ if init_kwarg_name :
397+ preferred_alias = alias_names [0 ]
398+ self .init_kwargs [preferred_alias ] = init_kwargs [init_kwarg_name .pop ()]
399+
392400 super ().__init__ (settings_cls )
393401 self .nested_model_default_partial_update = (
394402 nested_model_default_partial_update
You can’t perform that action at this time.
0 commit comments