diff --git a/form_designer/models.py b/form_designer/models.py index 79ace53..ae6e7a9 100644 --- a/form_designer/models.py +++ b/form_designer/models.py @@ -1,3 +1,5 @@ +from typing import Optional + import warnings from functools import partial @@ -51,7 +53,7 @@ def validate_comma_separated_emails(value): for v in value.split(","): validate_email(v.strip()) -def email_field_choices(form: forms.ModelForm | None, required: bool=True) -> list[tuple[str, str]]: +def email_field_choices(form: Optional[forms.ModelForm], required: bool=True) -> list[tuple[str, str]]: if not form or not form.instance or not form.instance.pk: return [] email_fields = form.instance.fields.filter(type='email')