From 0e9ebf838b09518fbfae26fe770218d47cce835f Mon Sep 17 00:00:00 2001 From: PIG208 <39874143+PIG208@users.noreply.github.com> Date: Thu, 28 Jul 2022 14:08:56 -0400 Subject: [PATCH] Support Lookup generics. (#1079) 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 03bf7f2..45767c6 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.files.utils import FileProxyMixin 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 @@ _need_generic: List[MPGeneric[Any]] = [ 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)),