Skip to content
Closed
Show file tree
Hide file tree
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
5 changes: 4 additions & 1 deletion django/db/models/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,10 @@ def __hash__(self):


class Manager(BaseManager.from_queryset(QuerySet)):
pass
# for static type-checking only, no effects on runtime
def __class_getitem__(cls, *args, **kwargs):
return cls



class ManagerDescriptor:
Expand Down
4 changes: 4 additions & 0 deletions django/db/models/query.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,10 @@ def __init__(self, model=None, query=None, using=None, hints=None):
self._iterable_class = ModelIterable
self._fields = None

# for static type-checking only, no effects on runtime
def __class_getitem__(cls, *args, **kwargs):
return cls

def as_manager(cls):
# Address the circular dependency between `Queryset` and `Manager`.
from django.db.models.manager import Manager
Expand Down