Model.objects should be a ClassVar

Model.objects is only available on classes and while we cannot force this, without ClassVar it's kind of only available on instances.

I have noticed this when I was writing a Jedi plugin that makes django-stubs work properly.
This commit is contained in:
Dave Halter authored and Adam Johnson committed 2022-11-03 13:36:03 +00:00
1 parent 1d78b8ffac
commit 7c995572c6
1 file changed
+2 -2
+2 -2
View File
@@ -1,4 +1,4 @@
from typing import Any, Collection, Dict, Iterable, List, Optional, Sequence, Set, Tuple, Type, TypeVar, Union
from typing import Any, ClassVar, Collection, Dict, Iterable, List, Optional, Sequence, Set, Tuple, Type, TypeVar, Union
from django.core.checks.messages import CheckMessage
from django.core.exceptions import MultipleObjectsReturned as BaseMultipleObjectsReturned
@@ -29,7 +29,7 @@ class Model(metaclass=ModelBase):
@classproperty
@classmethod
def _base_manager(cls: Type[_Self]) -> BaseManager[_Self]: ...
objects: BaseManager[Any]
objects: ClassVar[BaseManager[Any]]
pk: Any = ...
_state: ModelState
def __init__(self: _Self, *args: Any, **kwargs: Any) -> None: ...