diff --git a/django-stubs/contrib/gis/db/models/fields.pyi b/django-stubs/contrib/gis/db/models/fields.pyi index 8ca3757a4..9de810933 100644 --- a/django-stubs/contrib/gis/db/models/fields.pyi +++ b/django-stubs/contrib/gis/db/models/fields.pyi @@ -109,8 +109,8 @@ class GeometryField(BaseSpatialField[_ST, _GT]): error_messages: _ErrorMessagesMapping | None = ..., ) -> None: ... def formfield( # type: ignore[override] - self, form_class: type[forms.GeometryField] | None = ..., geom_type: str = ..., srid: Any = ..., **kwargs: Any - ) -> forms.GeometryField: ... + self, *, form_class: type[GeometryField] | None = ..., geom_type: str = ..., srid: Any = ..., **kwargs: Any + ) -> GeometryField: ... def select_format(self, compiler: Any, sql: Any, params: Any) -> Any: ... class PointField(GeometryField[_ST, _GT]): diff --git a/django-stubs/db/models/fields/__init__.pyi b/django-stubs/db/models/fields/__init__.pyi index 279131eca..471245bf8 100644 --- a/django-stubs/db/models/fields/__init__.pyi +++ b/django-stubs/db/models/fields/__init__.pyi @@ -205,10 +205,10 @@ class Field(RegisterLookupMixin, Generic[_ST, _GT]): # TODO: plugin support def formfield( self, - form_class: type[forms.Field] | None = ..., + form_class: type[Field] | None = ..., choices_form_class: type[forms.ChoiceField] | None = ..., **kwargs: Any, - ) -> forms.Field: ... + ) -> Field: ... def save_form_data(self, instance: Model, data: Any) -> None: ... def contribute_to_class(self, cls: type[Model], name: str, private_only: bool = ...) -> None: ... def to_python(self, value: Any) -> Any: ... diff --git a/scripts/stubtest/allowlist.txt b/scripts/stubtest/allowlist.txt index 7e783daf9..57feee188 100644 --- a/scripts/stubtest/allowlist.txt +++ b/scripts/stubtest/allowlist.txt @@ -14,10 +14,6 @@ django.contrib.auth.migrations.* django.contrib.flatpages.migrations.* django.contrib.contenttypes.migrations.* -# Annotate optional parameters which Django accepts as **kwargs -django.contrib.gis.db.models.GeometryField.formfield -django.contrib.gis.db.models.fields.GeometryField.formfield - # default_storage is actually an instance of DefaultStorage, but it proxies through to a Storage django.core.files.storage.default_storage