File tree 2 files changed +11
-5
lines changed
2 files changed +11
-5
lines changed Original file line number Diff line number Diff line change @@ -4,6 +4,9 @@ Change log
4
4
Next version
5
5
------------
6
6
7
+ * Limited the email field choices to email fields only when using the send
8
+ emails to authors option.
9
+
7
10
0.26
8
11
----
9
12
Original file line number Diff line number Diff line change 1
- from typing import Optional
2
-
3
1
import warnings
4
2
from functools import partial
3
+ from typing import Optional
5
4
6
5
from django import forms
7
6
from django .conf import settings
@@ -53,14 +52,18 @@ def validate_comma_separated_emails(value):
53
52
for v in value .split ("," ):
54
53
validate_email (v .strip ())
55
54
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 ]]:
57
59
if not form or not form .instance or not form .instance .pk :
58
60
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 [("" , "--" )]
61
63
choices .extend ([(_ .name , _ .title ) for _ in email_fields ])
62
64
return choices
63
65
66
+
64
67
class Form (models .Model ):
65
68
CONFIG_OPTIONS = [
66
69
(
You can’t perform that action at this time.
0 commit comments