Skip to content

Commit 17af341

Browse files
committed
Amend the CHANGELOG
1 parent 3d9e560 commit 17af341

File tree

2 files changed

+11
-5
lines changed

2 files changed

+11
-5
lines changed

CHANGELOG.rst

+3
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ Change log
44
Next version
55
------------
66

7+
* Limited the email field choices to email fields only when using the send
8+
emails to authors option.
9+
710
0.26
811
----
912

form_designer/models.py

+8-5
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
from typing import Optional
2-
31
import warnings
42
from functools import partial
3+
from typing import Optional
54

65
from django import forms
76
from django.conf import settings
@@ -53,14 +52,18 @@ def validate_comma_separated_emails(value):
5352
for v in value.split(","):
5453
validate_email(v.strip())
5554

56-
def email_field_choices(form: Optional[forms.ModelForm], required: bool=True) -> list[tuple[str, str]]:
55+
56+
def email_field_choices(
57+
form: Optional[forms.ModelForm], required: bool = True
58+
) -> list[tuple[str, str]]:
5759
if not form or not form.instance or not form.instance.pk:
5860
return []
59-
email_fields = form.instance.fields.filter(type='email')
60-
choices = [] if required else [('', '--')]
61+
email_fields = form.instance.fields.filter(type="email")
62+
choices = [] if required else [("", "--")]
6163
choices.extend([(_.name, _.title) for _ in email_fields])
6264
return choices
6365

66+
6467
class Form(models.Model):
6568
CONFIG_OPTIONS = [
6669
(

0 commit comments

Comments
 (0)