We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 451b2fb commit baaa808Copy full SHA for baaa808
ninja/filter_schema.py
@@ -1,4 +1,4 @@
1
-from typing import Any, cast
+from typing import Any, TypeVar, cast
2
3
from django.core.exceptions import ImproperlyConfigured
4
from django.db.models import Q, QuerySet
@@ -22,6 +22,9 @@
22
# )
23
24
25
+T = TypeVar("T", bound=QuerySet)
26
+
27
28
class FilterSchema(Schema):
29
# if TYPE_CHECKING:
30
# __config__: ClassVar[Type[FilterConfig]] = FilterConfig # pragma: no cover
@@ -49,7 +52,7 @@ def get_filter_expression(self) -> Q:
49
52
except NotImplementedError:
50
53
return self._connect_fields()
51
54
- def filter(self, queryset: QuerySet) -> QuerySet:
55
+ def filter(self, queryset: T) -> T:
56
return queryset.filter(self.get_filter_expression())
57
58
def _resolve_field_expression(
0 commit comments