Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

move _default_manager to ModelBase #1150

Merged
merged 4 commits into from
Nov 5, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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, **kwargs) -> None: ...
Expand Down