Skip to content

Commit

Permalink
make formfield() methods return Any
Browse files Browse the repository at this point in the history
  • Loading branch information
adamchainz committed Oct 19, 2022
1 parent dd42922 commit 17b1d2e
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
3 changes: 1 addition & 2 deletions src/django_mysql/models/fields/dynamic.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
Transform,
)
from django.db.models.sql.compiler import SQLCompiler
from django.forms import Field as FormField
from django.utils.translation import gettext_lazy as _

from django_mysql.models.lookups import DynColHasKey
Expand Down Expand Up @@ -289,7 +288,7 @@ def deconstruct(self) -> DeconstructResult:
kwargs["blank"] = False
return name, path, args, kwargs

def formfield(self, *args: Any, **kwargs: Any) -> FormField | None:
def formfield(self, *args: Any, **kwargs: Any) -> Any:
"""
Disabled in forms - there is no sensible way of editing this
"""
Expand Down
3 changes: 1 addition & 2 deletions src/django_mysql/models/fields/sets.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
from django.db.backends.base.base import BaseDatabaseWrapper
from django.db.models import CharField, Field, IntegerField, Model, TextField
from django.db.models.expressions import BaseExpression
from django.forms import Field as FormField
from django.utils.translation import gettext_lazy as _

from django_mysql.forms import SimpleSetField
Expand Down Expand Up @@ -130,7 +129,7 @@ def value_to_string(self, obj: Any) -> str:
vals = self.value_from_object(obj)
return self.get_prep_value(vals)

def formfield(self, **kwargs: Any) -> FormField:
def formfield(self, **kwargs: Any) -> Any:
defaults = {
"form_class": SimpleSetField,
"base_field": self.base_field.formfield(),
Expand Down

0 comments on commit 17b1d2e

Please sign in to comment.