Skip to content

Commit

Permalink
Fix Field.formfield(), GeometryField.formfield() methods (#1778)
Browse files Browse the repository at this point in the history
This partially reverts and fixes bugs introduced in 9010b5f.
  • Loading branch information
brianhelba authored Oct 19, 2023
1 parent a9c56a9 commit 35bd241
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
9 changes: 7 additions & 2 deletions django-stubs/contrib/gis/db/models/fields.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,13 @@ class GeometryField(BaseSpatialField[_ST, _GT]):
error_messages: _ErrorMessagesMapping | None = ...,
) -> None: ...
def formfield( # type: ignore[override]
self, *, form_class: type[GeometryField] | None = ..., geom_type: str = ..., srid: Any = ..., **kwargs: Any
) -> GeometryField: ...
self,
*,
form_class: type[forms.GeometryField] | None = ...,
geom_type: str = ...,
srid: Any = ...,
**kwargs: Any,
) -> forms.GeometryField: ...
def select_format(self, compiler: Any, sql: Any, params: Any) -> Any: ...

class PointField(GeometryField[_ST, _GT]):
Expand Down
4 changes: 2 additions & 2 deletions django-stubs/db/models/fields/__init__.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -205,10 +205,10 @@ class Field(RegisterLookupMixin, Generic[_ST, _GT]):
# TODO: plugin support
def formfield(
self,
form_class: type[Field] | None = ...,
form_class: type[forms.Field] | None = ...,
choices_form_class: type[forms.ChoiceField] | None = ...,
**kwargs: Any,
) -> Field: ...
) -> forms.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: ...
Expand Down

0 comments on commit 35bd241

Please sign in to comment.