mirror of
https://github.com/Hopiu/django-model-utils.git
synced 2026-03-17 04:10:24 +00:00
Override signature of query-returning methods in InheritanceManager
This commit is contained in:
parent
7d6cad0200
commit
ecc7312bf4
1 changed files with 69 additions and 0 deletions
|
|
@ -223,9 +223,78 @@ class InheritanceManagerMixin(Generic[ModelT]):
|
||||||
_queryset_class = InheritanceQuerySet
|
_queryset_class = InheritanceQuerySet
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
|
from collections.abc import Sequence
|
||||||
|
|
||||||
|
def none(self) -> InheritanceQuerySet[ModelT]:
|
||||||
|
...
|
||||||
|
|
||||||
|
def all(self) -> InheritanceQuerySet[ModelT]:
|
||||||
|
...
|
||||||
|
|
||||||
def filter(self, *args: Any, **kwargs: Any) -> InheritanceQuerySet[ModelT]:
|
def filter(self, *args: Any, **kwargs: Any) -> InheritanceQuerySet[ModelT]:
|
||||||
...
|
...
|
||||||
|
|
||||||
|
def exclude(self, *args: Any, **kwargs: Any) -> InheritanceQuerySet[ModelT]:
|
||||||
|
...
|
||||||
|
|
||||||
|
def complex_filter(self, filter_obj: Any) -> InheritanceQuerySet[ModelT]:
|
||||||
|
...
|
||||||
|
|
||||||
|
def union(self, *other_qs: Any, all: bool = ...) -> InheritanceQuerySet[ModelT]:
|
||||||
|
...
|
||||||
|
|
||||||
|
def intersection(self, *other_qs: Any) -> InheritanceQuerySet[ModelT]:
|
||||||
|
...
|
||||||
|
|
||||||
|
def difference(self, *other_qs: Any) -> InheritanceQuerySet[ModelT]:
|
||||||
|
...
|
||||||
|
|
||||||
|
def select_for_update(
|
||||||
|
self, nowait: bool = ..., skip_locked: bool = ..., of: Sequence[str] = ..., no_key: bool = ...
|
||||||
|
) -> InheritanceQuerySet[ModelT]:
|
||||||
|
...
|
||||||
|
|
||||||
|
def select_related(self, *fields: Any) -> InheritanceQuerySet[ModelT]:
|
||||||
|
...
|
||||||
|
|
||||||
|
def prefetch_related(self, *lookups: Any) -> InheritanceQuerySet[ModelT]:
|
||||||
|
...
|
||||||
|
|
||||||
|
def annotate(self, *args: Any, **kwargs: Any) -> InheritanceQuerySet[ModelT]:
|
||||||
|
...
|
||||||
|
|
||||||
|
def alias(self, *args: Any, **kwargs: Any) -> InheritanceQuerySet[ModelT]:
|
||||||
|
...
|
||||||
|
|
||||||
|
def order_by(self, *field_names: Any) -> InheritanceQuerySet[ModelT]:
|
||||||
|
...
|
||||||
|
|
||||||
|
def distinct(self, *field_names: Any) -> InheritanceQuerySet[ModelT]:
|
||||||
|
...
|
||||||
|
|
||||||
|
def extra(
|
||||||
|
self,
|
||||||
|
select: dict[str, Any] | None = ...,
|
||||||
|
where: list[str] | None = ...,
|
||||||
|
params: list[Any] | None = ...,
|
||||||
|
tables: list[str] | None = ...,
|
||||||
|
order_by: Sequence[str] | None = ...,
|
||||||
|
select_params: Sequence[Any] | None = ...,
|
||||||
|
) -> InheritanceQuerySet[Any]:
|
||||||
|
...
|
||||||
|
|
||||||
|
def reverse(self) -> InheritanceQuerySet[ModelT]:
|
||||||
|
...
|
||||||
|
|
||||||
|
def defer(self, *fields: Any) -> InheritanceQuerySet[ModelT]:
|
||||||
|
...
|
||||||
|
|
||||||
|
def only(self, *fields: Any) -> InheritanceQuerySet[ModelT]:
|
||||||
|
...
|
||||||
|
|
||||||
|
def using(self, alias: str | None) -> InheritanceQuerySet[ModelT]:
|
||||||
|
...
|
||||||
|
|
||||||
def get_queryset(self) -> InheritanceQuerySet[ModelT]:
|
def get_queryset(self) -> InheritanceQuerySet[ModelT]:
|
||||||
model: type[ModelT] = self.model # type: ignore[attr-defined]
|
model: type[ModelT] = self.model # type: ignore[attr-defined]
|
||||||
return self._queryset_class(model)
|
return self._queryset_class(model)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue