Skip to content

Commit 6d5d834

Browse files
authored
Merge pull request #23 from dotX12/dev
Dev to master
2 parents ba91c2a + 124f1d2 commit 6d5d834

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

pyfa_converter/main.py

+5-3
Original file line numberDiff line numberDiff line change
@@ -89,13 +89,15 @@ def make_form_parameter(field: ModelField) -> Any:
8989
the result of `Depends on` if it is.
9090
9191
"""
92-
if issubclass(field.type_, BaseModel):
92+
field_type = type(field.type_) if not isinstance(field.type_, type) else field.type_
93+
94+
if issubclass(field_type, BaseModel):
9395
# This is a sub-model.
94-
assert hasattr(field.type_, _type_var_name), (
96+
assert hasattr(field_type, _type_var_name), (
9597
f"Sub-model class for {field.name} field must be decorated with"
9698
f" `as_form` too."
9799
)
98-
attr = getattr(field.type_, _type_var_name)
100+
attr = getattr(field_type, _type_var_name)
99101
return Depends(attr) # noqa
100102
else:
101103
return cls.param_maker(field=field, _type=_type)

0 commit comments

Comments
 (0)