Skip to content

Commit 5829946

Browse files
committed
Linting fix
1 parent da8d003 commit 5829946

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

ninja_extra/shortcuts.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from typing import Any, Optional, Type, cast, no_type_check
1+
from typing import Any, Optional, Type, Union, cast, no_type_check
22

33
from django.db.models import Model, QuerySet
44
from ninja.types import DictStrAny, TCallable
@@ -25,7 +25,7 @@ def _get_queryset(klass: Type[Model]) -> QuerySet:
2525

2626
@no_type_check
2727
def get_object_or_exception(
28-
klass: Type[Model],
28+
klass: Union[Type[Model], QuerySet],
2929
error_message: str = None,
3030
exception: Type[APIException] = NotFound,
3131
**kwargs: Any
@@ -52,7 +52,9 @@ def _format_dict(table: DictStrAny) -> str:
5252

5353

5454
@no_type_check
55-
def get_object_or_none(klass: Type[Model], **kwargs: Any) -> Optional[Any]:
55+
def get_object_or_none(
56+
klass: Union[Type[Model], QuerySet], **kwargs: Any
57+
) -> Optional[Any]:
5658
queryset = _get_queryset(klass)
5759
_validate_queryset(klass, queryset)
5860
try:

0 commit comments

Comments
 (0)