Skip to content

Commit

Permalink
move _default_manager to ModelBase (#1150)
Browse files Browse the repository at this point in the history
* move _default_manager to ModelBase

* fix for mypy check

* Update base.pyi

* Update base.pyi
  • Loading branch information
clouds56 authored Nov 5, 2022
1 parent a007013 commit f4cf7f2
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions django-stubs/db/models/base.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ from django.core.exceptions import MultipleObjectsReturned as BaseMultipleObject
from django.core.exceptions import ObjectDoesNotExist, ValidationError
from django.db.models.manager import BaseManager
from django.db.models.options import Options
from django.utils.functional import classproperty

_Self = TypeVar("_Self", bound="Model")

Expand All @@ -16,20 +15,19 @@ class ModelState:
adding: bool = ...
fields_cache: ModelStateFieldsCacheDescriptor = ...

class ModelBase(type): ...
class ModelBase(type):
@property
def objects(cls: Type[_Self]) -> BaseManager[_Self]: ... # type: ignore[misc]
@property
def _default_manager(cls: Type[_Self]) -> BaseManager[_Self]: ... # type: ignore[misc]
@property
def _base_manager(cls: Type[_Self]) -> BaseManager[_Self]: ... # type: ignore[misc]

class Model(metaclass=ModelBase):
class DoesNotExist(ObjectDoesNotExist): ...
class MultipleObjectsReturned(BaseMultipleObjectsReturned): ...
class Meta: ...
_meta: Options[Any]
@classproperty
@classmethod
def _default_manager(cls: Type[_Self]) -> BaseManager[_Self]: ...
@classproperty
@classmethod
def _base_manager(cls: Type[_Self]) -> BaseManager[_Self]: ...
objects: BaseManager[Any]
pk: Any = ...
_state: ModelState
def __init__(self: _Self, *args: Any, **kwargs: Any) -> None: ...
Expand Down

0 comments on commit f4cf7f2

Please sign in to comment.