@@ -5,6 +5,7 @@ from datetime import date, time, timedelta
55from datetime import datetime as real_datetime
66from typing import Any , ClassVar , Generic , Literal , Protocol , TypeVar , overload
77
8+ from django import forms
89from django .core import validators # due to weird mypy.stubtest error
910from django .core .checks import CheckMessage
1011from django .core .exceptions import FieldDoesNotExist as FieldDoesNotExist
@@ -202,7 +203,12 @@ class Field(RegisterLookupMixin, Generic[_ST, _GT]):
202203 def get_db_prep_save (self , value : Any , connection : BaseDatabaseWrapper ) -> Any : ...
203204 def get_internal_type (self ) -> str : ...
204205 # TODO: plugin support
205- def formfield (self , form_class : Any | None = ..., choices_form_class : Any | None = ..., ** kwargs : Any ) -> Any : ...
206+ def formfield (
207+ self ,
208+ form_class : type [forms .Field ] | None = ...,
209+ choices_form_class : Any | None = ...,
210+ ** kwargs : Any ,
211+ ) -> Field : ...
206212 def save_form_data (self , instance : Model , data : Any ) -> None : ...
207213 def contribute_to_class (self , cls : type [Model ], name : str , private_only : bool = ...) -> None : ...
208214 def to_python (self , value : Any ) -> Any : ...
0 commit comments