From 17b1d2ef0b54b2f85e7b38a4d9513a07e55a61d7 Mon Sep 17 00:00:00 2001 From: Adam Johnson Date: Wed, 19 Oct 2022 10:04:34 +0100 Subject: [PATCH] make formfield() methods return Any --- src/django_mysql/models/fields/dynamic.py | 3 +-- src/django_mysql/models/fields/sets.py | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/django_mysql/models/fields/dynamic.py b/src/django_mysql/models/fields/dynamic.py index 026ff1031..21714fb73 100644 --- a/src/django_mysql/models/fields/dynamic.py +++ b/src/django_mysql/models/fields/dynamic.py @@ -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 @@ -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 """ diff --git a/src/django_mysql/models/fields/sets.py b/src/django_mysql/models/fields/sets.py index 062129263..b842f7396 100644 --- a/src/django_mysql/models/fields/sets.py +++ b/src/django_mysql/models/fields/sets.py @@ -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 @@ -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(),