1
0
mirror of https://github.com/django/django.git synced 2025-10-31 09:41:08 +00:00

Fixed #31223 -- Added __class_getitem__() to Manager and QuerySet.

This commit is contained in:
sobolevn
2020-02-02 13:15:58 +03:00
committed by Carlton Gibson
parent fc0b48d2e7
commit 578c03b276
4 changed files with 21 additions and 0 deletions

View File

@@ -35,6 +35,9 @@ class BaseManager:
"""Return "app_label.model_label.manager_name"."""
return '%s.%s' % (self.model._meta.label, self.name)
def __class_getitem__(cls, *args, **kwargs):
return cls
def deconstruct(self):
"""
Return a 5-tuple of the form (as_manager (True), manager_class,

View File

@@ -323,6 +323,9 @@ class QuerySet:
qs._fetch_all()
return qs._result_cache[0]
def __class_getitem__(cls, *args, **kwargs):
return cls
def __and__(self, other):
self._merge_sanity_check(other)
if isinstance(other, EmptyQuerySet):