Skip to content

Commit 9010b5f

Browse files
authored
Apply suggestions from code review
1 parent 0c97249 commit 9010b5f

File tree

3 files changed

+4
-8
lines changed

3 files changed

+4
-8
lines changed

django-stubs/contrib/gis/db/models/fields.pyi

+2-2
Original file line numberDiff line numberDiff line change
@@ -109,8 +109,8 @@ class GeometryField(BaseSpatialField[_ST, _GT]):
109109
error_messages: _ErrorMessagesMapping | None = ...,
110110
) -> None: ...
111111
def formfield( # type: ignore[override]
112-
self, form_class: type[forms.GeometryField] | None = ..., geom_type: str = ..., srid: Any = ..., **kwargs: Any
113-
) -> forms.GeometryField: ...
112+
self, *, form_class: type[GeometryField] | None = ..., geom_type: str = ..., srid: Any = ..., **kwargs: Any
113+
) -> GeometryField: ...
114114
def select_format(self, compiler: Any, sql: Any, params: Any) -> Any: ...
115115

116116
class PointField(GeometryField[_ST, _GT]):

django-stubs/db/models/fields/__init__.pyi

+2-2
Original file line numberDiff line numberDiff line change
@@ -205,10 +205,10 @@ class Field(RegisterLookupMixin, Generic[_ST, _GT]):
205205
# TODO: plugin support
206206
def formfield(
207207
self,
208-
form_class: type[forms.Field] | None = ...,
208+
form_class: type[Field] | None = ...,
209209
choices_form_class: type[forms.ChoiceField] | None = ...,
210210
**kwargs: Any,
211-
) -> forms.Field: ...
211+
) -> Field: ...
212212
def save_form_data(self, instance: Model, data: Any) -> None: ...
213213
def contribute_to_class(self, cls: type[Model], name: str, private_only: bool = ...) -> None: ...
214214
def to_python(self, value: Any) -> Any: ...

scripts/stubtest/allowlist.txt

-4
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,6 @@ django.contrib.auth.migrations.*
1414
django.contrib.flatpages.migrations.*
1515
django.contrib.contenttypes.migrations.*
1616

17-
# Annotate optional parameters which Django accepts as **kwargs
18-
django.contrib.gis.db.models.GeometryField.formfield
19-
django.contrib.gis.db.models.fields.GeometryField.formfield
20-
2117
# default_storage is actually an instance of DefaultStorage, but it proxies through to a Storage
2218
django.core.files.storage.default_storage
2319

0 commit comments

Comments
 (0)