Skip to content

Commit

Permalink
Make RelatedManager, ManyRelatedManager to inherit from Manager
Browse files Browse the repository at this point in the history
… not `BaseManager` (#1843)

* Restore RelatedManager inheritance from Manager
* Switch ManyRelatedManager to inherit from Manager
  • Loading branch information
intgr authored Nov 19, 2023
1 parent 1a59756 commit e37cef0
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions django-stubs/db/models/fields/related_descriptors.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ from django.db.models.base import Model
from django.db.models.fields import Field
from django.db.models.fields.related import ForeignKey, ManyToManyField, RelatedField
from django.db.models.fields.reverse_related import ManyToManyRel, ManyToOneRel, OneToOneRel
from django.db.models.manager import BaseManager
from django.db.models.manager import BaseManager, Manager
from django.db.models.query import QuerySet
from django.db.models.query_utils import DeferredAttribute
from django.utils.functional import cached_property
Expand Down Expand Up @@ -88,7 +88,7 @@ class ReverseManyToOneDescriptor:
def __set__(self, instance: Any, value: Any) -> NoReturn: ...

# Fake class, Django defines 'RelatedManager' inside a function body
class RelatedManager(BaseManager[_M], Generic[_M]):
class RelatedManager(Manager[_M], Generic[_M]):
related_val: tuple[int, ...]
def add(self, *objs: _M | int, bulk: bool = ...) -> None: ...
async def aadd(self, *objs: _M | int, bulk: bool = ...) -> None: ...
Expand Down Expand Up @@ -126,7 +126,7 @@ class ManyToManyDescriptor(ReverseManyToOneDescriptor, Generic[_M]):
def related_manager_cls(self) -> type[ManyRelatedManager[Any]]: ... # type: ignore[override]

# Fake class, Django defines 'ManyRelatedManager' inside a function body
class ManyRelatedManager(BaseManager[_M], Generic[_M]):
class ManyRelatedManager(Manager[_M], Generic[_M]):
related_val: tuple[int, ...]
def add(self, *objs: _M | int, bulk: bool = ...) -> None: ...
async def aadd(self, *objs: _M | int, bulk: bool = ...) -> None: ...
Expand Down

0 comments on commit e37cef0

Please sign in to comment.