Skip to content

Commit

Permalink
Model.objects should be a ClassVar
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
davidhalter committed Jun 11, 2020
1 parent 3d2534e commit fd05701
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions django-stubs/db/models/base.pyi
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from typing import Any, Callable, Dict, List, Optional, Sequence, Set, Tuple, Type, TypeVar, Union, Collection
from typing import Any, Callable, Dict, List, Optional, Sequence, Set, Tuple, Type, TypeVar, Union, Collection, ClassVar

from django.core.checks.messages import CheckMessage
from django.core.exceptions import ValidationError
Expand All @@ -22,7 +22,7 @@ class Model(metaclass=ModelBase):
class Meta: ...
_meta: Options[Any]
_default_manager: BaseManager[Model]
objects: BaseManager[Any]
objects: ClassVar[BaseManager[Any]]
pk: Any = ...
_state: ModelState
def __init__(self: _Self, *args, **kwargs) -> None: ...
Expand Down

0 comments on commit fd05701

Please sign in to comment.