From 09209da3e10411fdb1db84e6fe105bb076e4f98c Mon Sep 17 00:00:00 2001 From: Zixuan James Li Date: Thu, 28 Jul 2022 13:56:41 -0400 Subject: [PATCH] Support Lookup generics. Custom `Lookup` implementation will run into 'Missing type parameters for generic type "Lookup"' without having `Lookup` monkey-patched with django-stubs-ext. Signed-off-by: Zixuan James Li --- django_stubs_ext/django_stubs_ext/patch.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/django_stubs_ext/django_stubs_ext/patch.py b/django_stubs_ext/django_stubs_ext/patch.py index 03bf7f23e..45767c6dc 100644 --- a/django_stubs_ext/django_stubs_ext/patch.py +++ b/django_stubs_ext/django_stubs_ext/patch.py @@ -8,6 +8,7 @@ from django.core.paginator import Paginator from django.db.models.fields import Field from django.db.models.fields.related import ForeignKey +from django.db.models.lookups import Lookup from django.db.models.manager import BaseManager from django.db.models.query import QuerySet from django.forms.formsets import BaseFormSet @@ -57,6 +58,7 @@ def __repr__(self) -> str: MPGeneric(BaseModelFormSet), MPGeneric(Feed), MPGeneric(FileProxyMixin), + MPGeneric(Lookup), # These types do have native `__class_getitem__` method since django 3.1: MPGeneric(QuerySet, (3, 1)), MPGeneric(BaseManager, (3, 1)),