From 2e9adce5eb145db5e7f043e0c6c421dd00493db2 Mon Sep 17 00:00:00 2001 From: markedwards Date: Tue, 22 Dec 2020 07:09:29 +0000 Subject: [PATCH] Add Field to django_stubs_ext.django_stubs_ext.patch._need_generic (#547) --- 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 bf4e25d..522737f 100644 --- a/django_stubs_ext/django_stubs_ext/patch.py +++ b/django_stubs_ext/django_stubs_ext/patch.py @@ -3,6 +3,7 @@ from typing import Any, Generic, List, Optional, Tuple, Type, TypeVar from django import VERSION as VERSION from django.contrib.admin import ModelAdmin from django.contrib.admin.options import BaseModelAdmin +from django.db.models.fields import Field from django.db.models.manager import BaseManager from django.db.models.query import QuerySet from django.views.generic.edit import FormMixin @@ -38,6 +39,7 @@ _need_generic: List[MPGeneric[Any]] = [ MPGeneric(ModelAdmin), MPGeneric(FormMixin), MPGeneric(BaseModelAdmin), + MPGeneric(Field), # These types do have native `__class_getitem__` method since django 3.1: MPGeneric(QuerySet, (3, 1)), MPGeneric(BaseManager, (3, 1)),