Skip to content

Commit

Permalink
py 3.9 needs Optional
Browse files Browse the repository at this point in the history
  • Loading branch information
Martin J. Laubach committed Sep 10, 2024
1 parent 38b041b commit 92cabed
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion form_designer/models.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from typing import Optional

import warnings
from functools import partial

Expand Down Expand Up @@ -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')
Expand Down

0 comments on commit 92cabed

Please sign in to comment.