Skip to content

Commit 21bdb0e

Browse files
committed
fix lazy import bug #250
1 parent 1fc3c19 commit 21bdb0e

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

ninja_extra/conf/package_settings.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,14 @@
1111
from ninja_extra.interfaces.ordering import OrderingBase
1212
from ninja_extra.interfaces.route_context import RouteContextBase
1313
from ninja_extra.interfaces.searching import SearchingBase
14+
from ninja_extra.lazy import LazyStrImport
1415

1516
_GenericModelValidator = AllowTypeOfSource(
16-
validator=lambda source, value: isinstance(value, type)
17-
and issubclass(value, source),
17+
validator=lambda source, value: (
18+
isinstance(value, LazyStrImport)
19+
or isinstance(value, type)
20+
and issubclass(value, source)
21+
),
1822
error_message=lambda source,
1923
value: f"Expected type of {source.__name__}, received: {type(value)}",
2024
)

0 commit comments

Comments
 (0)