From 29884c89060960da5f8de4a5918f054b77668af1 Mon Sep 17 00:00:00 2001 From: Dejan Svetec Date: Sun, 10 Sep 2023 19:17:18 +0200 Subject: [PATCH] Make `RelatedManager` and `ManyToManyRelatedManager` callable --- django-stubs/db/models/manager.pyi | 2 ++ 1 file changed, 2 insertions(+) diff --git a/django-stubs/db/models/manager.pyi b/django-stubs/db/models/manager.pyi index a8267ff1d..78fdcaa58 100644 --- a/django-stubs/db/models/manager.pyi +++ b/django-stubs/db/models/manager.pyi @@ -37,6 +37,7 @@ class Manager(BaseManager[_T]): ... class RelatedManager(Manager[_T]): related_val: tuple[int, ...] + def __call__(self, *, manager: str) -> RelatedManager[_T]: ... def add(self, *objs: QuerySet[_T] | _T, bulk: bool = ...) -> None: ... async def aadd(self, *objs: QuerySet[_T] | _T, bulk: bool = ...) -> None: ... def remove(self, *objs: QuerySet[_T] | _T, bulk: bool = ...) -> None: ... @@ -60,6 +61,7 @@ class RelatedManager(Manager[_T]): class ManyToManyRelatedManager(Generic[_T, _V], Manager[_T]): through: type[_V] + def __call__(self, *, manager: str) -> ManyToManyRelatedManager[_T, _V]: ... def add( self, *objs: QuerySet[_T] | _T | _V,